QuestDB JavaScript Client - v5.0.0
    Preparing search index...

    Interface QwpBrowserWebSocketOptions

    Browser WebSocket transport and authentication, shared by both sides.

    Browsers cannot set Authorization or X-QWP-* upgrade headers. QuestDB accepts browser upgrades when Origin and Host have the same authority, or when the server lists the Origin in qwp.browser.allowed.origins. When authentication is enabled, a same-origin app can pass sessionBootstrap or call bootstrapQwpBrowserSession() first so the browser can attach qdb_session; an app on a listed origin passes auth instead.

    interface QwpBrowserWebSocketOptions {
        auth?: QwpBrowserSessionAuthentication | QwpBrowserAuthProvider;
        closeTimeoutMs?: number;
        connectTimeoutMs?: number;
        failoverUrls?: readonly (string | URL)[];
        protocols?: string | string[];
        sendTimeoutMs?: number;
        sessionBootstrap?: QwpBrowserSessionBootstrapConfig;
        url: string | URL;
        webSocketFactory?: (
            url: string | URL,
            protocols?: string | string[],
        ) => QwpWebSocketLike;
    }

    Hierarchy (View Summary)

    Index

    Properties

    Authenticates every WebSocket upgrade with a credential carried in its subprotocol offer instead of a session cookie. This is how a web application served from another origin, which QuestDB lists in qwp.browser.allowed.origins, connects. Pass a fixed credential, or a QwpBrowserAuthProvider the client calls before every connect, reconnect, and failover attempt, for example to supply a refreshed OIDC access token. Under a client's cluster it authenticates both sides, and a provider is called before every connection attempt of either side.

    QuestDB accepts the credential only from a listed origin: a page served from QuestDB's own origin must be listed too, or keep using sessionBootstrap. It creates no session for the credential and ignores cookies on the upgrade. Use wss:: the credential travels in the opening HTTP request. Cannot be combined with sessionBootstrap.

    closeTimeoutMs?: number

    Maximum time allowed for a graceful WebSocket close. Defaults to 15s. Capped at 2,147,483,647ms (the host timer ceiling); a larger value throws a RangeError.

    connectTimeoutMs?: number

    Node TCP/TLS connection deadline, or the complete opening deadline in a browser. Defaults to 15s. Capped at 2,147,483,647ms (the host timer ceiling); a larger value throws a RangeError.

    failoverUrls?: readonly (string | URL)[]

    Additional endpoints attempted in order when the preferred endpoint fails.

    protocols?: string | string[]
    sendTimeoutMs?: number

    Maximum time a send may remain queued by the WebSocket. Defaults to 15s. Capped at 2,147,483,647ms (the host timer ceiling); a larger value throws a RangeError.

    Authenticates over REST before every WebSocket connection attempt so the browser can attach QuestDB's HttpOnly session cookies to the upgrade. Without a url, it targets /exec beside the endpoint being connected. Cannot be combined with auth.

    url: string | URL
    webSocketFactory?: (
        url: string | URL,
        protocols?: string | string[],
    ) => QwpWebSocketLike

    Test or framework hook; defaults to the browser's global WebSocket. Under a client's cluster it is shared, and either side may override it.