UNPKG

@gladiaio/sdk

Version:

Gladia JavaScript/TypeScript SDK

56 lines (55 loc) 1.5 kB
import { WebSocketRetryOptions } from "../types.cjs"; import { IsoWS, WS_STATES } from "./iso-ws.cjs"; //#region src/network/wsClient.d.ts type WebSocketClientOptions = { baseUrl: string | URL; retry: Required<WebSocketRetryOptions>; timeout: number; }; declare class WebSocketClient { private readonly baseUrl; private readonly retry; private readonly timeout; constructor(options: WebSocketClientOptions); createSession(url: string): WebSocketSession; } declare class WebSocketSession implements Omit<IsoWS, "onopen"> { onconnecting: ((event: { connection: number; attempt: number; }) => void) | null; onopen: ((event: { connection: number; attempt: number; }) => void) | null; onerror: IsoWS["onerror"]; onclose: IsoWS["onclose"]; onmessage: IsoWS["onmessage"]; private _readyState; private _url; private readonly retry; private readonly timeout; private ws; private connectionCount; private connectionAttempt; private connectionTimeoutId; constructor({ retry, timeout, url }: { retry: Required<WebSocketRetryOptions>; timeout: number; url: string | URL; }); get readyState(): IsoWS["readyState"]; get url(): IsoWS["url"]; send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void; close(code?: number, reason?: string): void; private onWsClose; private connect; private clearConnectionTimeout; } //#endregion export { WebSocketClient }; //# sourceMappingURL=wsClient.d.cts.map