Member Junction
    Preparing search index...

    Interface RealtimeReconnectControllerOptions

    Options for the unified I/O-free RealtimeReconnectController.

    interface RealtimeReconnectControllerOptions {
        AttemptTimeoutMs?: number;
        BuildSeed: () => RealtimeMemorySeed;
        DeadlineMarginMs?: number;
        HoldsHardMove?: () => boolean;
        IsIdle?: () => boolean;
        IsNetworkOnline?: () => boolean;
        Log?: (message: string) => void;
        MaxRapidReconnects?: number;
        MaxRetryDelayMs?: number;
        OnReconnected?: (usedNativeResumption: boolean) => void;
        OnReconnectFailed: (
            error: Error,
            code: RealtimeReconnectFailureCode,
        ) => void;
        OnReconnecting?: (reason: RealtimeReconnectReason) => void;
        PrepareAttempt?: (context: RealtimeReconnectContext) => Promise<void>;
        PrepareTimeoutMs?: number;
        RapidReconnectWindowMs?: number;
        Reconnect: (context: RealtimeReconnectContext) => Promise<void>;
        RecoveryWindowMs?: number;
        RequiresPostTurnHandle?: () => boolean;
        RetryDelaysMs?: readonly number[];
        ReturnToOldConnection?: () => boolean;
        TrustsNativeResumption?: () => boolean;
    }
    Index

    Properties

    AttemptTimeoutMs?: number

    Per-attempt timeout in milliseconds for Reconnect (default 15000).

    BuildSeed: () => RealtimeMemorySeed

    Builds the conversation memory seed when reconnecting without native resumption.

    DeadlineMarginMs?: number

    Maximum deadline margin in milliseconds for ConnectionEnding notices (default 10000).

    HoldsHardMove?: () => boolean

    Returns true when the user has said something the current connection has not answered yet and no turn is open for it: a provider that opens the turn only when its answer starts (Gemini) would otherwise lose those words at the hard point. The hard-point move then waits as it does for an open turn (see deferHardMoveToTurnEnd); the driver calls RealtimeReconnectController.NotifyIdleStateChanged when the hold ends without a turn. Omitted: only an open turn holds the hard point.

    IsIdle?: () => boolean

    Returns true when no turn is open and no tool calls are in flight.

    IsNetworkOnline?: () => boolean

    Optional host network-reachability probe (for example navigator.onLine !== false in browsers). When false at the time a transport attempt fails, the controller treats the failure as local network unreachability rather than a server rejection of ResumptionHandle, preserving the handle so the first online attempt can still resume natively.

    Log?: (message: string) => void

    Diagnostic logger.

    MaxRapidReconnects?: number

    Maximum rapid reconnects allowed within RapidReconnectWindowMs (default 5).

    MaxRetryDelayMs?: number

    Wait in milliseconds between attempts after RetryDelaysMs is used up (default 5000).

    OnReconnected?: (usedNativeResumption: boolean) => void

    Invoked when an attempt succeeds and the replacement connection is active.

    OnReconnectFailed: (error: Error, code: RealtimeReconnectFailureCode) => void

    Invoked once when the cycle gives up (its recovery window closed, or it made MAX_REALTIME_RESUMPTION_ATTEMPTS attempts) or the rapid-reconnect circuit breaker trips.

    OnReconnecting?: (reason: RealtimeReconnectReason) => void

    Invoked when a reconnect cycle begins.

    PrepareAttempt?: (context: RealtimeReconnectContext) => Promise<void>

    Optional work an attempt needs before it opens the transport, such as minting a fresh credential. It runs on its own PrepareTimeoutMs budget, and Reconnect starts (with its own AttemptTimeoutMs) only when it resolves in time: an attempt abandoned during preparation never reaches Reconnect. A rejection or a timeout fails the attempt like a Reconnect failure, so the retry schedule bounds it.

    PrepareTimeoutMs?: number

    Per-attempt timeout in milliseconds for PrepareAttempt (default 15000).

    RapidReconnectWindowMs?: number

    Sliding window in milliseconds for the rapid-reconnect circuit breaker (default 30000).

    Reconnect: (context: RealtimeReconnectContext) => Promise<void>

    Opens a replacement connection using either a native handle or a memory seed and swaps it in.

    RecoveryWindowMs?: number

    How long in milliseconds a cycle keeps trying once the connection is gone (default 45000); see REALTIME_RESUMPTION_RECOVERY_WINDOW_MS. 0 limits a lost connection to the RetryDelaysMs attempts, and a planned move to the life left on its old connection.

    RequiresPostTurnHandle?: () => boolean

    Returns true when the provider emits a fresh resumable handle shortly after each turnComplete (e.g. Gemini / Vertex AI Live), so a planned move (goAway or soft window) that occurs during a turn should wait for that post-turn RecordHandle(..., true) (bounded by the deadline timer) rather than resuming from the pre-turn handle.

    RetryDelaysMs?: readonly number[]

    Start of the attempt schedule in milliseconds (default [0, 1000, 3000]). These attempts always run; after them, attempts wait MaxRetryDelayMs each while the recovery window is open.

    ReturnToOldConnection?: () => boolean

    A planned move's attempt failed while its old connection still carries the call (before the last call before its end). The driver goes back to live on that connection (its state, its input) and returns true, or returns false when it cannot (the old connection is gone too, or the driver tore it down for the attempt). After true, RealtimeReconnectController.IsReconnecting is false until the next attempt, which waits for the retry delay and then for the next idle boundary, the hard point (unless a turn or HoldsHardMove holds it), or the last call; OnReconnecting fires again when it starts. A loss of the old connection (TriggerReconnect('connection-lost')) fires it at once instead and ends the wait, and the cycle goes on as a lost connection. Omitted or false: the next attempt follows the retry schedule, with the client still reconnecting. A throw counts as false, and OnReconnecting fires again, since the driver may have gone part way back.

    TrustsNativeResumption?: () => boolean

    Returns true when native resumption handles are trusted on the current session/topology.