Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a timeout status event #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

manan-jadhav
Copy link

  • 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

@andreyleskov
Copy link

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.

@dmonad
Copy link
Member

dmonad commented Jul 9, 2024

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' }.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants