commit 18/06/2025
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user