vapor-chamber API reference - v1.3.0
    Preparing search index...

    Type Alias SseBridgeOptions

    type SseBridgeOptions = {
        url: string;
        onEvent: (event: MessageEvent, bus: BaseBus) => void;
        withCredentials?: boolean;
        reconnect?: boolean;
    }
    Index

    Properties

    url: string

    SSE endpoint URL

    onEvent: (event: MessageEvent, bus: BaseBus) => void

    Called for each server-sent event. Use this to dispatch incoming server events back into the command bus.

    createSseBridge({
    url: '/api/vc/events',
    onEvent: (event, bus) => {
    const data = JSON.parse(event.data)
    bus.dispatch(data.command, data.target, data.payload)
    }
    })
    withCredentials?: boolean

    Send credentials with the SSE request. Default: false

    reconnect?: boolean

    Reconnect automatically (EventSource does this natively). Default: true