diff --git a/html/index.html b/html/index.html index 947213c..a6792de 100644 --- a/html/index.html +++ b/html/index.html @@ -227,6 +227,28 @@

Leaderboard

// Add code here to highlight the word in the grid with the specified color console.log("Highlighting word '" + word + "' with color: " + color); } + window.onload = function() { + // Create a WebSocket connection to the server + var serverUrl = "ws://" + window.location.hostname + ":9108"; + var connection = new WebSocket(serverUrl); + + // When the connection is opened + connection.onopen = function () { + console.log("Connected to server"); + // Send a message to the server to clear the queue + connection.send(JSON.stringify({ action: "clearQueue" })); + }; + + // Handle messages from the server + connection.onmessage = function (evt) { + // Handle messages from the server if needed + }; + + // Handle connection errors + connection.onerror = function(error) { + console.error("WebSocket error: ", error); + }; + };