onState(Subscribe to state updates; returns an unsubscribe function. Parameterslistener): () =>void
Returns
() =>
void
The Local Copy
The client keeps a local copy of the agent’s state. Every connection, reconnects included, starts the copy from a snapshot. EachsetState on the agent then arrives as an RFC 7396 merge patch. Each replaceState arrives as a new snapshot.
A listener receives the whole copy after every change. A listener added after the first snapshot is called at once with the current copy.