From 354a19b76b71a39b047e89df729f7d8a98e1b528 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 19 Jun 2024 00:22:55 +0200 Subject: different host when using wss --- test-client/main.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test-client/main.ts') 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); -- cgit v1.2.3-70-g09d2