laneya2

cave exploration game
git clone https://git.ce9e.org/laneya2.git

commit
a9a153f24a7c8b3bcfd51fc5ab4e30c2c2510465
parent
f9a2ffa9d164e0afff373e637bf2d1bf1ac9d0d2
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-09-22 04:13
client: fix socket protocol

Diffstat

M static/main.js 3 ++-

1 files changed, 2 insertions, 1 deletions


diff --git a/static/main.js b/static/main.js

@@ -4,7 +4,8 @@ var radius = 5;
    4     4 var params = new URLSearchParams(location.search);
    5     5 var gameId = params.get('game');
    6     6 
    7    -1 var socket = new WebSocket(`ws://${location.host}/ws/${gameId}`);
   -1     7 var socketProtocol = location.protocol.replace('http', 'ws');
   -1     8 var socket = new WebSocket(`${socketProtocol}//${location.host}/ws/${gameId}`);
    8     9 
    9    10 var send = function(data) {
   10    11     socket.send(JSON.stringify(data));