From 0d69a63b62fe32b7634d702fbd50b06b2817e621 Mon Sep 17 00:00:00 2001 From: Xamora Date: Fri, 19 Jan 2024 17:00:30 +0100 Subject: [PATCH] Fix lag; Camille forgot usleep(500) --- frontend/static/js/api/game/Game.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/frontend/static/js/api/game/Game.js b/frontend/static/js/api/game/Game.js index e8a3e5f..f5e708d 100644 --- a/frontend/static/js/api/game/Game.js +++ b/frontend/static/js/api/game/Game.js @@ -73,13 +73,10 @@ class Game if (this._socket === undefined) return; - const loop_id = setInterval(() => { - if (this._socket.readyState === WebSocket.OPEN) - { - this._socket.send(JSON.stringify(data)); - clearInterval(loop_id); - } - }, 500); + if (this._socket.readyState === WebSocket.OPEN) + { + this._socket.send(JSON.stringify(data)); + } } _send_paddle_position(position, time) @@ -208,4 +205,4 @@ class Game } } -export { Game } \ No newline at end of file +export { Game }