Packages@robojs/sync
SyncCallContext<T, ClientData>
Interface: SyncCallContext<T, ClientData>
Context passed to RPC call handlers.
Type Parameters
| Type Parameter | Default type |
|---|---|
T | unknown |
ClientData | unknown |
Properties
| Property | Type | Description |
|---|---|---|
broadcast | (payload: unknown) => void | Broadcast ephemeral message to all clients |
cleanKey | string | The normalized key string |
client | HandlerClient<ClientData> | The client making the call |
getClients | () => Client<ClientData>[] | Get all clients subscribed to this key |
getHost | () => undefined | string | Get current host client ID |
getState | () => undefined | T | Get current state for this key |
key | string[] | The full key array |
params | Record<string, string> | Dynamic route parameters |
send | (clientId: string, payload: unknown) => void | Send ephemeral message to specific client |
setState | (data: T) => void | Set state (broadcasts automatically) |
