diff options
author | metamuffin <metamuffin@disroot.org> | 2024-06-19 00:22:55 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-06-23 19:21:22 +0200 |
commit | 354a19b76b71a39b047e89df729f7d8a98e1b528 (patch) | |
tree | 7e0868d041935ff1157f220f91e4adcdeaf4c579 /test-client | |
parent | 203a4309a762488a4de72123e2f08f229e607e1a (diff) | |
download | hurrycurry-354a19b76b71a39b047e89df729f7d8a98e1b528.tar hurrycurry-354a19b76b71a39b047e89df729f7d8a98e1b528.tar.bz2 hurrycurry-354a19b76b71a39b047e89df729f7d8a98e1b528.tar.zst |
different host when using wss
Diffstat (limited to 'test-client')
-rw-r--r-- | test-client/main.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test-client/main.ts b/test-client/main.ts index 20ec2a18..23bf4052 100644 --- a/test-client/main.ts +++ b/test-client/main.ts @@ -11,7 +11,10 @@ let ctx: CanvasRenderingContext2D; let canvas: HTMLCanvasElement; let ws: WebSocket; document.addEventListener("DOMContentLoaded", () => { - ws = new WebSocket(`${window.location.protocol.endsWith("s:") ? "wss" : "ws"}://${window.location.hostname}:27032/`) + const ws_uri = window.location.protocol.endsWith("s:") + ? `wss://game.${window.location.hostname}/` + : `ws://${window.location.hostname}:27032/` + ws = new WebSocket(ws_uri) ws.onerror = console.error ws.onmessage = m => { packet(JSON.parse(m.data) as PacketC); |