Skip to main content
client.events follows changes in a workspace as they happen, and client.notifications sends and reads messages for the people in it.

Subscribe to live events

Every change in a workspace is written to a log, and events.subscribe listens to it.
subscribe returns a function that stops listening. The connection recovers by itself if it drops.

Shape of an event

Each event has a type, a sequence number that only increases, the actor that caused it and occurredAt. Common types: The change feed lists every type.

Resume after a restart

Store the sequence of the last event handled. After a restart, pass it as after to receive only later events.
onStatus reports the state of the connection: connecting, open, reconnecting or closed.

Notifications

notifications is the signed-in person’s own inbox, and the way to notify others.
to is all, a list of roles, a list of users, or me. markRead, markUnread, markAllRead and delete manage received notifications.