@mocanvas/sync · class

PresenceRoom

declare class PresenceRoom<R extends UnknownRecord>

Holds the presence records of everyone else: puts them in the store as they arrive, drops them on bye, and sweeps clients that went quiet.


Methods · 7

clear(): void

Remove every record this room put in the store.

constructor(store: Store<R, any>, timeoutMs?: number)
receive(clientId: string, record: R): void

Store an incoming presence record and remember when we saw its client.

remove(clientId: string): void

Drop one client's presence (it said goodbye).

startSweeping(intervalMs?: number): void
stopSweeping(): void
sweep(now?: number): void

Drop every client we have not heard from within the timeout.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.