Room Lifecycle
Rooms are created via the REST API and cannot be created from the client SDK. The typical flow is:-
Your backend creates a room via
POST /rooms -
Your backend adds a user via
POST /users, gets a JWT token -
The client SDK connects and joins the room using the JWT token
-
The room tracks participants, presence, and all collaboration state
Users can join as an editor or viewer:
Roles are session-scoped. Editors are active collaborators and appear in
client.users.active; viewers receive realtime updates and can follow users, but cannot write collaboration state. After connecting and joining, room information is available using:You can also fetch the current room’s details from the server:This method returns room details. Useclient.users.list(...)for paginated users andclient.users.activefor active editors.
Connection Lifecycle
The client exposes low-level connection events viaclient.socket. Use these to monitor connection state, handle disconnections, and implement custom reconnection logic like so:
Lifecycle Events
Auto-Reconnection
The SDK automatically reconnects when the WebSocket connection drops unexpectedly. It uses exponential backoff with configurable parameters:- Reconnection starts immediately after disconnection
- Each subsequent attempt waits longer (exponential backoff)
- After all attempts are exhausted, the
failedevent fires