Interface StreamTransport

The send/subscribe transport consumeStream drives (injected so it can be faked in tests).

interface StreamTransport {
    cancel?: (msg: { cancel: true; msgId: number; type: string }) => void;
    send: (
        msg: {
            method: string;
            msgId: number;
            params: unknown[];
            stream: true;
            type: string;
        },
    ) => void;
    subscribe: (
        type: string,
        handler: (msg: { msgId?: number; stream?: StreamFrame }) => void,
    ) => () => void;
}

Properties

cancel?: (msg: { cancel: true; msgId: number; type: string }) => void
send: (
    msg: {
        method: string;
        msgId: number;
        params: unknown[];
        stream: true;
        type: string;
    },
) => void
subscribe: (
    type: string,
    handler: (msg: { msgId?: number; stream?: StreamFrame }) => void,
) => () => void