Skip to content

Commit

Permalink
fix: don't spawn new instances on reconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
sockmaster27 committed Aug 21, 2024
1 parent 00387ba commit 3f634ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/src/engine/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ export function initialiseSocket({ uri, onOpen, onClose }: InitialiseSocketInput
WebSocket,
})

webSocket.addEventListener('open', () => {
webSocket.addEventListener('open', function openHandler() {
webSocketOpen = true
if (onOpen !== undefined) {
setTimeout(onOpen, 0)
}

webSocket.removeEventListener('open', openHandler)
})

webSocket.addEventListener('close', () => {
Expand Down

0 comments on commit 3f634ea

Please sign in to comment.