Libraries
    Preparing search index...

    Interface UseSubscriptionState<TOutgoing, TIncoming>

    The state returned by useSubscription.

    interface UseSubscriptionState<TOutgoing, TIncoming> {
        close: () => void;
        error: Error | undefined;
        events: TOutgoing[];
        lastEvent: TOutgoing | undefined;
        send: (message: TIncoming) => void;
        state: "connecting" | "connected" | "reconnecting" | "closed";
    }

    Type Parameters

    • TOutgoing
    • TIncoming
    Index

    Properties

    close: () => void

    Close the subscription.

    error: Error | undefined

    The last error that occurred, if any.

    events: TOutgoing[]

    All events received so far (newest last).

    lastEvent: TOutgoing | undefined

    The most recently received event.

    send: (message: TIncoming) => void

    Send a message to the server (bidirectional subscriptions).

    state: "connecting" | "connected" | "reconnecting" | "closed"

    Current connection state.