Skip to content

Commit

Permalink
html
Browse files Browse the repository at this point in the history
update
  • Loading branch information
Guerrero96 committed Apr 22, 2024
1 parent f707340 commit 9b62432
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,28 @@ <h3>Leaderboard</h3>
// 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);
};
};
</script>
</body>
</html>

0 comments on commit 9b62432

Please sign in to comment.