What problem does it solve?
Developers need a reliable way to synchronize Yjs CRDT documents over network connections while handling authentication, connection lifecycles, and error recovery. Without a dedicated provider, implementing these concerns manually leads to duplicated code, fragile reconnection logic, and inconsistent state across clients.
Core Features & Use Cases
- Configurable Provider Options: Set document, base URL, doc ID, optional awareness, custom headers, live mode (SSE or long‑poll), and auto‑connect behavior.
- Dynamic Authentication: Supply static tokens or functions that refresh per request, enabling seamless credential rotation.
- Robust Connection State Machine: Automatic transitions between disconnected, connecting, and connected states with graceful handling of errors.
- Error Recovery & Reconnection: Built‑in retries for network hiccups, server errors, and snapshot discovery failures, while emitting clear status events.
- Event‑Driven API: Listen to
synced, status, and error events to integrate with UI frameworks such as React.
Quick Start
Ask the assistant to configure a YjsProvider for document “my-doc” using SSE mode with automatic reconnection.