// the find
yjs/y-websocket
Websocket Connector for Yjs
y-websocket is the official WebSocket provider for Yjs, handling real-time document sync and awareness (cursors, presence) between clients through a central server. It's for developers building collaborative editing features with Yjs who want a straightforward client-server topology rather than peer-to-peer.
- Cross-tab sync via BroadcastChannel with localStorage fallback is handled automatically — you don't have to think about multiple tabs in the same browser.
- The new syncStatus API (green/yellow/red) gives meaningful signal about whether local updates have been confirmed by the server, which is genuinely useful for showing users data-loss risk.
- Exponential backoff reconnection is built in and configurable via maxBackoffTime, and params can be updated at runtime so rotating auth tokens actually work.
- The WebSocketPolyfill option makes Node.js usage straightforward without any monkey-patching.
- The repo is in a transitional state: stable y-websocket targets Yjs v13, the main branch targets v14 (@y/y), and the server code was split out to @y/websocket-server — this is genuinely confusing for someone starting fresh today.
- The in-memory server has no built-in persistence or horizontal scaling story; that's punted to @y/hub or third-party options, which means the 'quick start' gets you something that loses all data on restart.
- Test coverage is thin — one test file for the whole client implementation, and there are no tests that actually exercise reconnection logic or the sync-status state machine.
- The syncStatus feature explicitly only works with certain backends (yhub), but this caveat is easy to miss and will result in the status being permanently stale for most self-hosted setups.