createSseBridge — server-sent events bridge for unidirectional server push.
SSE is receive-only: the server pushes events to the client. Use onEvent to map incoming server events to bus dispatches.
onEvent
const sse = createSseBridge({ url: '/api/vc/stream', onEvent: (event, bus) => { const { command, target } = JSON.parse(event.data) bus.dispatch(command, target) }})sse.install(bus)// Later, on component unmount:sse.teardown() Copy
const sse = createSseBridge({ url: '/api/vc/stream', onEvent: (event, bus) => { const { command, target } = JSON.parse(event.data) bus.dispatch(command, target) }})sse.install(bus)// Later, on component unmount:sse.teardown()
createSseBridge — server-sent events bridge for unidirectional server push.
SSE is receive-only: the server pushes events to the client. Use
onEventto map incoming server events to bus dispatches.