import { VirtualWebSocketClient } from './virtual-websocket-client'; import { IDatabaseServiceContext } from '@cloudbase/types/database'; import { IWatchOptions, DBRealtimeListener, IRequestMessage } from '@cloudbase/types/realtime'; import { CloseEventCode } from './ws-event'; export interface IRealtimeWebSocketClientConstructorOptions { maxReconnect?: number; reconnectInterval?: number; context: IDatabaseServiceContext; } export interface ISignature { envId: string; secretVersion: number; signStr: string; wsUrl: string; expireTS: number; } export interface ILoginInfo { loggedIn: boolean; loggingInPromise?: Promise; loginStartTS?: number; loginResult?: ILoginResult; } export interface ILoginResult { envId: string; } export interface IWSSendOptions { msg: IRequestMessage; waitResponse?: boolean; skipOnMessage?: boolean; timeout?: number; } export interface IWSWatchOptions extends IWatchOptions { envId?: string; collectionName: string; query: string; limit?: number; orderBy?: Record; } export declare class RealtimeWebSocketClient { private virtualWSClient; private queryIdClientMap; private watchIdClientMap; private maxReconnect; private reconnectInterval; private context; private ws?; private lastPingSendTS?; private pingFailed; private pongMissed; private pingTimeoutId?; private pongTimeoutId?; private logins; private wsInitPromise?; private wsReadySubsribers; private wsResponseWait; private rttObserved; private reconnectState; private wsSign; constructor(options: IRealtimeWebSocketClientConstructorOptions); clearHeartbeat(): void; send: (opts: IWSSendOptions) => Promise; close(code: CloseEventCode): void; closeAllClients: (error: any) => void; pauseClients: (clients?: Set) => void; resumeClients: (clients?: Set) => void; watch(options: IWSWatchOptions): DBRealtimeListener; private initWebSocketConnection; private initWebSocketEvent; private isWSConnected; private onceWSConnected; private webLogin; private getWsSign; private getWaitExpectedTimeoutLength; private heartbeat; private ping; private onWatchStart; private onWatchClose; }