From a037eea658b6564cdd10e81ebbb21e281305b232 Mon Sep 17 00:00:00 2001 From: rexim Date: Fri, 16 Aug 2024 00:44:14 +0700 Subject: [PATCH] Document the GitHub Pages hack --- game.mts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/game.mts b/game.mts index 76fc923..490556e 100644 --- a/game.mts +++ b/game.mts @@ -835,6 +835,14 @@ export async function createGame(): Promise { }; const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; const ws = new WebSocket(`${protocol}//${window.location.hostname}:${SERVER_PORT}`); + // HACK: This application is deployed to GitHub Pages for the demo + // purposes. Unfortunately, GitHub Pages only allow hosting static + // assets, so we can only operate in Offline Mode. At the same + // time, tsoding.github.io accepts WebSocket connection on the + // port 6970 and later times out on the shandshake which results + // in the client displaying "Connecting..." for the whole time, + // which does not look good in the demo. So if we are on + // tsoding.github.io we just instantly close the connection. if (window.location.hostname === 'tsoding.github.io') ws.close(); const me = { id: 0,