Re-enable live stats #1

Open
opened 2023-10-01 02:27:46 +00:00 by silver · 1 comment
silver commented 2023-10-01 02:27:46 +00:00 (Migrated from gitlab.skynet.ie)

The previous version of this page had live stats for the discord server.

Because we are using Crafty Config we have use of a status page.
It should be possible to use the websocket (like below) to re-implmnet functionality that was available in the previous version.

const webSocket = new WebSocket("wss://config.minecraft.games.skynet.ie/ws?page=/status&page_query_params=");
webSocket.onmessage = (event) => {
  console.log(event.data);
};
The [previous version][1] of this page had live stats for the discord server. Because we are using [Crafty Config][2] we have use of a [status page][3]. It should be possible to use the websocket (like below) to re-implmnet functionality that was available in the previous version. ```javascript const webSocket = new WebSocket("wss://config.minecraft.games.skynet.ie/ws?page=/status&page_query_params="); webSocket.onmessage = (event) => { console.log(event.data); }; ``` [1]: https://gitlab.skynet.ie/compsoc1/skynet/website/games.skynet.ie/-/blob/b6714f17627edfa52e05fa0f761fcb540ebbb3c4/index.php [2]: https://docs.craftycontrol.com/ [3]: https://config.minecraft.games.skynet.ie/status
esy commented 2023-10-02 11:42:51 +00:00 (Migrated from gitlab.skynet.ie)

Trying this with this code,

const socket = new WebSocket("wss://config.minecraft.games.skynet.ie/ws?page=/status&page_query_params=");
socket.addEventListener('open', function (event) {
    console.log("connected to server");
});

socket.addEventListener('message', function(event) {
    console.log("message from server : ",event.data);
});


const sendMessage = () => {
    socket.send("test");
}

gets a 403 Forbidden error as seen below suggesting it needs some authentication.
image

May have to use some api provided by crafty controller - https://wiki.craftycontrol.com/en/4/docs/API%20V2#get-a-server-s-statistics

Trying this with this code, ```javascript const socket = new WebSocket("wss://config.minecraft.games.skynet.ie/ws?page=/status&page_query_params="); socket.addEventListener('open', function (event) { console.log("connected to server"); }); socket.addEventListener('message', function(event) { console.log("message from server : ",event.data); }); const sendMessage = () => { socket.send("test"); } ``` gets a 403 Forbidden error as seen below suggesting it needs some authentication. ![image](/uploads/d3caf1749270c49cb7b9b83d96c93276/image.png) May have to use some api provided by crafty controller - https://wiki.craftycontrol.com/en/4/docs/API%20V2#get-a-server-s-statistics
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Skynet/website_games#1
No description provided.