Realtime
The realtime task map
The five things you actually do on the realtime layer — add a channel, publish an event, subscribe, read presence, invalidate Hub queries.
Every realtime ticket is one of five jobs. Read How realtime works first if Centrifugo, the two tokens, and the channel registry are not yet familiar — each page below assumes them.
Creating a channel
Add a kind to REALTIME_CHANNELS and teach the token endpoint to grant it.
Publishing an event
Extend RealtimeEventMap and call publishTo — never a raw publish.
Subscribing from the Hub
useRealtimeChannel: grant, on(event), cleanup.
Using presence
Participant vs observer, and who appears in the online set.
Invalidating Hub queries
Domain action on the wire, React Query keys on the Hub.