import { DurableSocketChannel } from "./channel"; /** * Provides a durable WebSocket. Such a socket will automatically handle reconnection including * exponential backoff and jitter. It will also enqueue messages while the socket is down and * send them once connection is restored. * * Drop in compatible with WebSocket, with some additional events: * - 'lost': fired when the connection goes down * - 'restore': fired when the connection is restored after being down * * The standard open and close events only fire when the connection is initially established * and when the socket is intentionally ended by calling close(). */ export declare class DurableSocket implements WebSocket { readonly url: string; readonly protocols?: string | string[]; constructor(url: string, protocols?: string | string[], sessionId?: string); ready: Promise; /** * Wait until this connection is ready to receive a message. If connection is lost, this method will * return a new promise that will resolve when connection is restored. * @returns */ waitUntilReady(): Promise; asChannel(): DurableSocketChannel; private connect; get urlWithSessionId(): string; private pingTimer; private lastPong; private _sessionId; /** * Get the session ID assigned to this session by the server. * This session ID will be included when reconnecting to allow for * state retention even after reconnecting. */ get sessionId(): string; private handleConnect; enablePing: boolean; pingInterval: number; pingKeepAliveInterval: number; private handleMessage; private _closed; private handleLost; private get actualReconnectTime(); private reconnect; private _open; reconnectTime: number; maxReconnectTime: number; maxAttempts: number; jitter: number; private _ready; private _messageQueue; private _attempt; private _socket; private _subscribers; get binaryType(): BinaryType; get bufferedAmount(): number; get extensions(): string; get CLOSED(): number; get CLOSING(): number; get CONNECTING(): number; get OPEN(): number; get onclose(): (this: WebSocket, ev: CloseEvent) => any; get onerror(): (this: WebSocket, ev: Event) => any; get onmessage(): (this: WebSocket, ev: MessageEvent) => any; get onopen(): (this: WebSocket, ev: Event) => any; set onclose(value: (this: WebSocket, ev: CloseEvent) => any); set onerror(value: (this: WebSocket, ev: Event) => any); set onmessage(value: (this: WebSocket, ev: MessageEvent) => any); set onopen(value: (this: WebSocket, ev: Event) => any); private _onclose; private _onerror; private _onmessage; private _onopen; get protocol(): string; get readyState(): number; close(code?: number, reason?: string): void; send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void; addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; dispatchEvent(event: Event): boolean; }