y-websocket icon indicating copy to clipboard operation
y-websocket copied to clipboard

Add a timeout status event

Open manan-jadhav opened this issue 3 years ago • 2 comments

  • A new status event: 'timeout' is fired when there has been inactivity on the websocket for a while and the websocket is marked for closing
  • This is really handy with detecting network disconnection, because in that case the websocket does not really fire the 'close' event until the browser has finished the closing handshake.
  • Added documentation for this

manan-jadhav avatar Nov 09 '22 15:11 manan-jadhav

Is it possible to merge this? I use tldraw with y-websocket and observe weird behavior of all whiteboard to refresh and lose ability to react to hotkeys. Took me a few days to dig in and find the reason of y-websocket auto-close on inactivity. Now server cannot distinguish it from document delete-related socket closure. Additional timeout status would save several hours of debug.

andreyleskov avatar Jul 09 '24 05:07 andreyleskov

The idea of the status event is to tell the user about the connection status. Hence, I'd prefer to add a status event { status: 'disconnecting', reason: 'timeout' | 'manual' }.

dmonad avatar Jul 09 '24 14:07 dmonad