import * as Corti from "../../api/index.js"; import { StreamClient } from "../../api/resources/stream/client/Client.js"; import { type ProxyOptions } from "../utils/encodeHeadersAsWsProtocols.js"; import { CustomStreamSocket } from "./CustomStreamSocket.js"; export type CustomStreamConnectArgs = { id: string; /** When provided, connect() resolves after CONFIG_ACCEPTED or rejects on failure. */ configuration?: Corti.StreamConfig; /** * When true (default), connect() resolves after CONFIG_ACCEPTED or rejects on failure. * When false, returns socket immediately; config errors are dispatched as ErrorEvent. */ awaitConfiguration?: boolean; /** * When provided, bypasses normal URL construction and auth. The WebSocket connects * directly to proxy.url. Useful for proxy backends that handle auth themselves. */ proxy?: ProxyOptions; } & Partial>; export declare class CustomStream extends StreamClient { private readonly _encodeHeadersAsWsProtocols; private readonly _analytics; constructor(options: StreamClient.Options & { encodeHeadersAsWsProtocols?: boolean; analytics?: Record; }); connect(args: CustomStreamConnectArgs): Promise; /** * Sends configuration on open, then resolves after CONFIG_ACCEPTED. * Rejects and closes socket on CONFIG_DENIED / CONFIG_MISSING / CONFIG_TIMEOUT / * CONFIG_NOT_PROVIDED / connection error / ENDED. */ private _connectWithConfigAck; /** * Sends configuration on open and returns the socket immediately. * Config errors are dispatched as ErrorEvent and the socket is closed. */ private _connectWithConfigListeners; /** Resolves on CONFIG_ACCEPTED; rejects on rejection types, socket error, or ENDED. */ private _buildConfigAckPromise; }