commit 18/06/2025

This commit is contained in:
2025-06-23 12:26:08 +07:00
parent 3ed1123d1a
commit 0d572514db
15 changed files with 95 additions and 27 deletions

View File

@@ -1,19 +1,13 @@
console.log("Initializing websocket");
if (window.socket==null) {
window.socket = new WebSocket("ws://" + location.host + "/ws");
console.log("creating window.socket");
} else {
console.log("window.socket already exists");
}
}
socket.onopen = () => {
console.log("WebSocket connected");
};
socket.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log("Received from server:", data);
};
socket.onerror = (err) => {
console.error("WebSocket error:", err);