LogoRobo.js
Packages@robojs/sync

SyncContext<ClientData>

Interface: SyncContext<ClientData>

Context object returned by useSyncState, useSyncContext, and useSyncBroadcast. Provides client awareness, host status, and messaging capabilities.

Type Parameters

Type ParameterDefault type
ClientDataunknown

Properties

PropertyTypeDescription
broadcast(payload: unknown) => voidSend an ephemeral message to all clients in the room
clientIdstringThe current client's unique identifier
clientsClient<ClientData>[]Array of all clients connected to this key/room
isHostbooleanWhether the current client is the host (first to connect)
send(clientId: string, payload: unknown) => voidSend an ephemeral message to a specific client

On this page