Skip to main content

index/type-aliases/StreamEventCallbacks.md

StreamEventCallbacks = { [K in keyof typeof STREAM_CALLBACK_EVENTS]?: (event: RealtimeEventPayloads[typeof STREAM_CALLBACK_EVENTS[K]]) => void | Promise<void> }

Callbacks for stream events, one optional onX per event. Passed to subscribeToStream(token, callbacks) they become subscribers of that token (and the room is joined for as long as one of them is registered); passed to connectStreamWebSocket(callbacks) they become subscribers of the event on every token. Each registered callback is its own subscriber: no callback replaces another.