interface OpenAlgoWsConfig {
    apiKey: string;
    auth?: { ackTimeoutMs?: number; requireAck?: boolean };
    heartbeat?: { probeMs?: number; timeoutMs?: number };
    reconnect?: {
        baseDelayMs?: number;
        enabled?: boolean;
        jitter?: boolean;
        maxAttempts?: number;
        maxDelayMs?: number;
        random?: () => number;
    };
    socketFactory?: SocketFactory;
    url: string;
}

Properties

apiKey: string
auth?: { ackTimeoutMs?: number; requireAck?: boolean }

Handshake gating. Data frames wait for the server's answer to authenticate.

Type declaration

  • OptionalackTimeoutMs?: number

    Wait for the acknowledgement this long before failing the connection (default 5000).

  • OptionalrequireAck?: boolean

    Require a positive acknowledgement (default true). Set false only for a proxy build known to answer nothing: the connection then counts as authenticated on transport open, and one AUTH_UNACKNOWLEDGED warning is raised per connection so the missing guarantee is visible rather than silently assumed.

heartbeat?: { probeMs?: number; timeoutMs?: number }

Liveness watchdog. After timeoutMs with no inbound frame the client asks the far end a direct question and gives it probeMs to answer; only silence to that counts as death, and the socket is then reconnected (defaults 45000 and 5000; a timeoutMs of 0 disables the watchdog).

reconnect?: {
    baseDelayMs?: number;
    enabled?: boolean;
    jitter?: boolean;
    maxAttempts?: number;
    maxDelayMs?: number;
    random?: () => number;
}

Auto-reconnect after an unexpected close: re-authenticate and resubscribe every active subscription, with jittered exponential backoff. Enabled by default; close() is treated as intentional and never reconnects.

Type declaration

  • OptionalbaseDelayMs?: number
  • Optionalenabled?: boolean
  • Optionaljitter?: boolean

    Full jitter on each delay (default true). Off gives the old lockstep timing.

  • OptionalmaxAttempts?: number
  • OptionalmaxDelayMs?: number
  • Optionalrandom?: () => number

    Injectable [0,1) source, so a test pins the delay instead of guessing it.

socketFactory?: SocketFactory
url: string