From ba43753636d127a618e7e7bbe3dfc9faba646d73 Mon Sep 17 00:00:00 2001 From: rexim Date: Fri, 16 Aug 2024 00:38:47 +0700 Subject: [PATCH] Automatically close connection of on tsoding.github.io --- game.mjs | 2 ++ game.mts | 1 + 2 files changed, 3 insertions(+) diff --git a/game.mjs b/game.mjs index 48a6316..0b60366 100644 --- a/game.mjs +++ b/game.mjs @@ -672,6 +672,8 @@ export async function createGame() { }; const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; const ws = new WebSocket(`${protocol}//${window.location.hostname}:${SERVER_PORT}`); + if (window.location.hostname === 'tsoding.github.io') + ws.close(); const me = { id: 0, position: new Vector2(), diff --git a/game.mts b/game.mts index 6833f13..76fc923 100644 --- a/game.mts +++ b/game.mts @@ -835,6 +835,7 @@ export async function createGame(): Promise { }; const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; const ws = new WebSocket(`${protocol}//${window.location.hostname}:${SERVER_PORT}`); + if (window.location.hostname === 'tsoding.github.io') ws.close(); const me = { id: 0, position: new Vector2(),