Packages@robojs/sync
ServerZone<T>
Interface: ServerZone<T>
Server-side zone handle for direct state manipulation. Use SyncServer.getZone(key) to obtain an instance.
Type Parameters
| Type Parameter | Default type |
|---|---|
T | unknown |
Properties
| Property | Type | Description |
|---|---|---|
broadcast | (payload: unknown) => void | Broadcast ephemeral message to all clients |
getClients | () => Client<unknown>[] | Get all clients subscribed to this zone |
getHost | () => undefined | string | Get current host ID |
getState | () => undefined | T | Get current state for this zone key |
send | (clientId: string, payload: unknown) => void | Send ephemeral message to specific client |
setHost | (clientId: null | string) => void | Override the host for this zone |
setState | (data: T) => void | Set state (broadcasts to all subscribers) |
