From 122e0b4d31baf649890e8941c5b4ed2e2a722089 Mon Sep 17 00:00:00 2001 From: nemo Date: Mon, 25 Nov 2024 09:27:54 +0100 Subject: [PATCH] fix port? --- load.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/load.js b/load.js index 1dd4e37..96c3ecf 100644 --- a/load.js +++ b/load.js @@ -49,7 +49,14 @@ function wasm_function(name) return global_instance.exports[name]; } -const connection = new WebSocket(document.URL.replace("http", "ws").replace(/(:6969|\/$)/, ":4242") /* get ws url to localhost or server */); +var WS_URL = ""; +if (document.URL.includes("localhost") ) { + WS_URL = document.URL.replace("http", "ws").replace("6969", "4242") +} else { + WS_URL = "wss://ws.penger.party/"; +} + +const connection = new WebSocket(WS_URL); // const connection = new WebSocket(document.URL.replace("http", "ws")); connection.onopen = (e) => { console.log("connection to server opened"); }; connection.onmessage = (e) => {