ReferenceAsk
A

AppEvent

Type
One published event delivered to onEvent: the channel, the payload, and when it was published.

The event your onEvent handler receives. channel tells you which channel it came in on, so a single subscription can cover several and route by it; data is whatever the backend published, kept small on purpose; ts is when it was published. Read the payload as a nudge and fetch the authoritative record.

AppEvent.ts
interface AppEvent {
  channel: string
  data: unknown
  ts: number
}
Fields
channel
string
The channel the event was published to. Route on it when one subscription covers several channels.
data
unknown
The payload the backend published. Small by design, so it is usually an id to fetch by.
ts
number
Publish time, milliseconds since epoch.
Route by channel
onEvent: (e: AppEvent) => {
  if (e.channel.startsWith('jobs:')) refreshJob((e.data as any).id);
}