Skip to main content

CollabKitRole

Session-scoped role chosen at join time or changed with client.updateRole(...).

SocketClientEventMap

Event map for client.socket.on() listeners.

SocketState

Possible connection states.

SocketClientOptions

Options for the low-level socket client.

SocketMessageResponseMap

Maps each client request MessageType to the data shape of its corresponding server response. Used by sendMessagePromise to infer the response type from the request type at compile time.
Note: CollabKitUser objects in WebSocket responses have token, room_id, and created_at stripped for payload efficiency and security. These fields are only present in REST API responses.

Broadcast Message Types

The server sends batched broadcast messages to connected clients when editors become active or inactive:
Join and leave events are batched over a short window to reduce message volume under high concurrency. Viewer joins/leaves are not broadcast. The client SDK handles these transparently and emits individual userJoined / userLeft events per active editor.

InferResponseData

Helper type that infers the response data type for a given client message. Falls back to Record<string, any> for unrecognised message types.
This enables type-safe responses from sendMessagePromise without manual casts: