UseSyncDemoOptions
See source codeTable of contents
interface UseSyncDemoOptions {}
Properties
roomId
The room ID to sync with. Make sure the room ID is unique. The namespace is shared by everyone using the demo server. Consider prefixing it with your company or project name.
roomId: string
userInfo
A signal that contains the user information needed for multiplayer features.
This should be synchronized with the userPreferences
configuration for the main <Tldraw />
component.
If not provided, a default implementation based on localStorage will be used.
userInfo?: Signal<TLPresenceUserInfo> | TLPresenceUserInfo
Methods
getUserPresence
A reactive function that returns a TLInstancePresence object.
This function is called reactively whenever the store state changes and determines what presence information to broadcast to other clients. The result is synchronized across all connected clients for displaying cursors, selections, and other collaborative indicators.
If not provided, uses the default implementation which includes standard cursor position and selection state. Custom implementations allow you to add additional presence data like current tool, view state, or custom status.
See getDefaultUserPresence for the default implementation of this function.
Parameters
Name | Description |
---|---|
| The current TLStore |
| The current user information |
Returns
null | TLPresenceStateInfo
Presence state to broadcast to other clients, or null to hide presence