From 9b62432fb7605f52449a59528cb7a777090ce0e2 Mon Sep 17 00:00:00 2001 From: Guerrero96 Date: Sun, 21 Apr 2024 19:02:16 -0500 Subject: [PATCH] html update --- html/index.html | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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); + }; + };