-
Notifications
You must be signed in to change notification settings - Fork 71
Description
If the client's websocket remains open, but messages for some reason aren't being received from the server, then the server will assume the client is no longer responding to messages, and flag them as disconnected, "closing" the websocket. On the client's end, as far as they're concerned, the websocket is still open. This can create very rare circumstances where the user has technically disconnected from a game, but their client doesn't inform them of that, and they lose the game, along with rating points if applicable. LPDJ experienced this.
Currently, the server sends a generic message every 10 seconds of no messages sent, expecting an echo from the client, just to make sure the connection is still active and the client is hearing and responding to messages. For extra safety, we should also implement a system client-side, where if they don't hear one of these periodic server messages when expected (with a small cushion), then it assumes we are disconnected, no longer receiving server messages, closes the websocket, and displays a message to the user that they are disconnected. This should hopefully fix any remaining invisible disconnects.
This periodic message the server sends to make sure the client is responding is located in sendSocketMessage.renewConnection(), and the client's websocket code is in websocket.js.