LogoRobo.js
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 ParameterDefault type
Tunknown

Properties

PropertyTypeDescription
broadcast(payload: unknown) => voidBroadcast ephemeral message to all clients
getClients() => Client<unknown>[]Get all clients subscribed to this zone
getHost() => undefined | stringGet current host ID
getState() => undefined | TGet current state for this zone key
send(clientId: string, payload: unknown) => voidSend ephemeral message to specific client
setHost(clientId: null | string) => voidOverride the host for this zone
setState(data: T) => voidSet state (broadcasts to all subscribers)

On this page