RTCForge API Reference v1.1.1
    Preparing search index...

    Interface TransportOptions

    Construction options for a Transport. Passed by RTCForgeClient to its TransportFactory; can also be supplied directly when instantiating WebSocketTransport standalone.

    interface TransportOptions {
        connectTimeoutMs?: number;
        logger?: Logger;
        maxQueueSize?: number;
        maxReconnectAttempts?: number;
        maxReconnectDelay?: number;
        nonRetryableCloseCodes?: number[];
        reconnect?: boolean;
        reconnectStrategy?: BackoffStrategy;
        sendQueue?: MessageQueue<
            | { data: unknown; to: string; type: "signal" }
            | { type: "pong" }
            | { channel: string; data?: unknown; type: "broadcast" },
        >;
        tokenRefresh?: () => Promise<string>;
    }
    Index

    Properties

    connectTimeoutMs?: number

    Timeout (ms) for a single connect attempt. 0 disables the timeout.

    10000

    logger?: Logger

    Logger for connection lifecycle diagnostics.

    noopLogger

    maxQueueSize?: number

    Maximum number of messages buffered while offline before sends are rejected. Ignored when a custom sendQueue is supplied.

    100

    maxReconnectAttempts?: number

    Maximum reconnect attempts before giving up; unlimited when omitted.

    maxReconnectDelay?: number

    Upper bound (ms) on the exponential-backoff reconnect delay.

    32000

    nonRetryableCloseCodes?: number[]

    WebSocket close codes that must NOT trigger a reconnect — retrying would be futile (e.g. a rejected/expired auth token closes with 1008). On such a close the transport emits TransportEvent.Terminated and stops.

    [1008]

    reconnect?: boolean

    Whether to automatically reconnect after an unexpected close.

    false for WebSocketTransport; RTCForgeClient passes true by default.

    reconnectStrategy?: BackoffStrategy

    Custom backoff policy; defaults to a jittered exponential ReconnectStrategy.

    sendQueue?: MessageQueue<
        | { data: unknown; to: string; type: "signal" }
        | { type: "pong" }
        | { channel: string; data?: unknown; type: "broadcast" },
    >

    Custom offline message buffer; defaults to a bounded SendQueue.

    tokenRefresh?: () => Promise<string>

    Async callback invoked before each reconnect to obtain a fresh auth token, which is written to the token query parameter of the socket URL.