Realtime
Realtime pushes Events, Messages and record changes to Apps and agents as they happen, resumable from a cursor.
Realtime pushes Events, Messages and record changes to connected Apps and agents as they happen. A client that drops resumes from its cursor and misses nothing.
Stream in the SDK
Leaseline declares a Lease Noun. Its manager screen shows each renewal the moment it lands:
import { $ } from 'startup-builder'
const cursor = localStorage.getItem('cursor') ?? undefined
for await (const event of $.stream('Lease.renewed', { cursor })) {
console.log(event.name, event.data)
localStorage.setItem('cursor', String(event.seq))
}Stream to a local server
The CLI forwards each Event, signed, to a local URL, and fires test Events on demand:
npx startup-builder listen Offer.subscribed --forward-to http: //localhost: 3000/ hooks
npx startup-builder trigger Offer.subscribedRules
| Rule | Detail |
|---|---|
| Selectors | A stream reads by Event selector, such as Lease.*, under the caller's Permissions |
| Order | Every item carries a sequence number; reconnect with the last one to receive every later item in order |
| Transport | Web sockets or server-sent events at wss: |
| Cost | A stream is a read and creates no Action per item; open connections count against a Limit per Tenant |
| Presence | Presence and typing reach a Channel's members live and are never stored |
| Agents | An agent in a Channel receives its Messages as they arrive; Dashboards refresh live |