Set interval for readying command

This commit is contained in:
snen 2021-10-01 19:54:43 -04:00
parent a3146f055f
commit fcd8868849
1 changed files with 6 additions and 1 deletions

View File

@ -244,7 +244,12 @@ export default function useServerSocket(
React.useEffect(() => {
if (state.status !== 'pre-game') return
sendJson({command: 'ready', player_id: state.playerId, match_id: state.matchId})
const intervalId = setInterval(() => {
sendJson({command: 'ready', player_id: state.playerId, match_id: state.matchId})
}, 200)
return () => {
clearInterval(intervalId)
}
}, [sendJson, state])
React.useEffect(() => {