Skip to main content
The collaboration WebSocket provides real-time presence tracking for sessions with team visibility. See who is viewing a session, track cursor positions, and receive live updates when collaborators join or leave.

Connection

Obtain ws_token from the Token Exchange endpoint with capability: "collaborate". Required scope: sessions:read

Authentication

The token query parameter authenticates the connection. Invalid or expired tokens result in an immediate close with code 4001.

Receiving messages

Once connected, the server sends presence events as JSON messages:

user_joined

A user has connected to the session:

user_left

A user has disconnected:

cursor_update

A collaborator’s cursor position has changed:

selection_change

A collaborator has selected text:

Sending messages

You can broadcast your own cursor and selection state by sending the same message types:

Example: presence tracking

Auto-disconnect

The server closes idle collaboration connections after 30 minutes of inactivity. Cursor and selection updates count as activity. Reconnect with a fresh token when needed.

Privacy

Collaboration is only available on sessions with team visibility. Private sessions do not accept collaboration WebSocket connections - the token exchange returns 403.