Skip to content

Commit

Permalink
game: Fixing reconnection when game is over
Browse files Browse the repository at this point in the history
  • Loading branch information
okbrandon committed Oct 18, 2024
1 parent 7acc55b commit 485ea7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/src/components/Game/remote/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Game = () => {

const { sendMessage, lastMessage, readyState } = useWebSocket(process.env.REACT_APP_ENV === 'production' ? '/ws/match' : 'ws://localhost:8000/ws/match', {
onClose: event => { if (event.code === 1006) handleReconnect() },
shouldReconnect: () => true,
shouldReconnect: () => !gameOver,
});

const handleReconnect = useCallback(() => {
Expand Down

0 comments on commit 485ea7e

Please sign in to comment.