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 Parameter | Default type |
|---|---|
ClientData | unknown |
Properties
| Property | Type | Description |
|---|---|---|
broadcast | (payload: unknown) => void | Send an ephemeral message to all clients in the room |
clientId | string | The current client's unique identifier |
clients | Client<ClientData>[] | Array of all clients connected to this key/room |
isHost | boolean | Whether the current client is the host (first to connect) |
send | (clientId: string, payload: unknown) => void | Send an ephemeral message to a specific client |
