Live listeners
Get a document or a query's results, then every change to them as it happens: added, modified and removed.
A live listener is a query (or one document) that stays open. You get the current results first, then a snapshot with the changes every time a write affects them. Each listener sees only what its own user may read: the query re-runs as that user, with your collection rules and row policies.
const stop = await sov.collection('rooms/r1/messages')
.orderBy('at', 'desc').limit(50)
.onSnapshot((snap) => {
render(snap.docs)
for (const c of snap.changes) console.log(c.type, c.doc.id) // added | modified | removed
}, (err) => console.warn(err))
const stopDoc = await sov.doc('users/alice').onSnapshot((doc) => setProfile(doc.data))
stop(); stopDoc()How it behaves
- Only the user who started a listener can subscribe to its channel, and nobody can publish on it.
- Listeners expire after 10 minutes unless renewed; the SDKs renew every 5 minutes. Renewing checks the collection rules again, so revoked access stops within one renewal.
- After a reconnect, or when an update was missed, the SDKs re-run the query once and report the difference, so a snapshot never silently drifts.
- Writes to collections nobody listens to cost nothing extra.
- Each update is one realtime message and counts toward monthly realtime messages; listener channels don't count toward realtime channels.
Plan limits
| Limit | Free | Pro | Ultra | Team | Enterprise |
|---|---|---|---|---|---|
Live listeners open at once (docs.max_listeners) | 100 | 2,000 | 10,000 | 25,000 | 100,000 |
Documents one listener tracks (docs.listener_max_docs) | 500 | 1,000 | 2,000 | 5,000 | 10,000 |
Over the cap, starting a listener returns 403 PLAN_LIMIT_REACHED.
Something unclear or missing on this page?Tell us