Skip to content

gdmp.state

Shared key → value state: the server writes, every client reads and hears changes. A late joiner gets everything.

Call What it does
get(key) / keys() both sides
server: set(key, value) / delete(key) value = any JSON value
client: onChanged(cb) cb({key, value, deleted})

The declarations from the GDMP types (namespace GDMP), comments included:

interface StateServer extends StateCommon {
set(key: string, value: Json): void;
delete(key: string): void;
}
interface StateClient extends StateCommon {
onChanged(cb: Callback<[change: StateChange]>): void;
}
interface StateChange { readonly key: string; readonly value: Received; readonly deleted: boolean }