Skip to main content
The TypeScript SDK exposes live objects and live collections through repository callbacks. A live object callback receives one object snapshot. A live collection callback receives a list snapshot plus pagination helpers when the query supports paging. Repository observers watch SDK cache state. For cross-device real-time updates, subscribe to the topic that matches the object or collection scope, then clean up both the repository observer and the topic subscription.

Platform Surface

Parameters

Observe A Live Object

This example observes one post and subscribes to the post topic after the first post snapshot is available.

Observe A Live Collection

Use the collection callback to render the latest list. Keep the next-page function and call it only when the UI requests more data.

Notes

  • getPost(), getMessage(), getChannel(), getCommunity(), getUser(), getPoll(), getRoom(), and similar singular methods follow the same live-object callback pattern.
  • Query methods such as getPosts(), getComments(), getMessages(), getMembers(), getReactions(), getRooms(), and getStreams() follow the live-collection callback pattern.
  • The callback can emit local/cache data before server data. Use loading, error, and origin if your UI needs to distinguish phases.
  • Keep topic subscriptions as narrow as possible. A post-detail screen should subscribe to the post topic; a community feed screen should subscribe to the community post topic.
  • Always dispose the observer returned by the repository and any topic unsubscribe functions returned by subscribeTopic().

Post Retrieval

See post-specific live object and collection usage.

TypeScript Real-time Events

Subscribe to social topics for cross-device updates.