Fix lag; Camille forgot usleep(500)

This commit is contained in:
Xamora 2024-01-19 17:00:30 +01:00
parent c6990ebb3e
commit 0d69a63b62

View File

@ -73,13 +73,10 @@ class Game
if (this._socket === undefined) if (this._socket === undefined)
return; return;
const loop_id = setInterval(() => { if (this._socket.readyState === WebSocket.OPEN)
if (this._socket.readyState === WebSocket.OPEN) {
{ this._socket.send(JSON.stringify(data));
this._socket.send(JSON.stringify(data)); }
clearInterval(loop_id);
}
}, 500);
} }
_send_paddle_position(position, time) _send_paddle_position(position, time)
@ -208,4 +205,4 @@ class Game
} }
} }
export { Game } export { Game }