Presence
Properties
Section titled “Properties”clientId
Section titled “clientId”readonly clientId: string;Methods
Section titled “Methods”close()
Section titled “close()”close(): void;Returns
Section titled “Returns”void
getPeers()
Section titled “getPeers()”getPeers(): readonly Peer[];Stable array snapshot (replaced on change) — safe for useSyncExternalStore.
Returns
Section titled “Returns”readonly Peer[]
setMetadata()
Section titled “setMetadata()”setMetadata(metadata): void;Publish new metadata for this client, announcing it to peers.
A no-op when the value has not actually changed, so calling it on every render — which is what a hook does — costs nothing and announces nothing.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
metadata | unknown |
Returns
Section titled “Returns”void
subscribe()
Section titled “subscribe()”subscribe(fn): () => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fn | () => void |
Returns
Section titled “Returns”() => void