yjs / y-websocket

Websocket Connector for Yjs
https://docs.yjs.dev/ecosystem/connection-provider/y-websocket
MIT License
523 stars 261 forks source link

Add a timeout status event #127

Open manan-jadhav opened 1 year ago

manan-jadhav commented 1 year ago
andreyleskov commented 3 months ago

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 commented 3 months ago

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