Skip to main content
The Presence module lets users share short-lived, ephemeral state with other participants. Common use cases include live cursor tracking, text selections, scroll positions, and typing indicators. Access it via client.presence.
Presence data is not persisted — it exists only while users are connected.
Only editors can send presence updates. Viewers can receive presence updates and can follow users, but presence.update(...) is blocked for viewer sessions.

Methods

Update Presence

update() Broadcast your current presence state to other participants. The input is a freeform object — you can include any data you want.
Updates are throttled at 50ms to prevent flooding the WebSocket. If you call update() more frequently, the latest state is sent after the throttle window.

Subscribe to Presence Updates

sync(target, callback) Subscribe to presence changes from other users. The target parameter controls which users you receive updates from:

Unsubscribe from Presence Updates

unsync() Unsubscribe from presence updates:

Get All States

getStates() Get all current presence states as a map:

Get State

getState(userId?: string) Get a specific user’s presence state, or the current user’s state if no ID is provided:

Examples

Live Cursors

Follow Users

Use the 'following' sync target combined with the follow/unfollow user methods to build a “follow mode” where one user’s viewport mirrors another’s: