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)
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 }
export { Game }