/// import { EventEmitter2 } from "eventemitter2"; import Debug from 'debug'; import WebSocket from "ws"; import { WSServer } from "."; import { NodeJSError, GenericNodejsCallback } from '../types'; import { WsConn } from "./wsConn"; export interface WSClientConnectionOptions { parent?: WSClient | WSServer; url: string; pingInterval: number; inactivityTimeout: number; reconnectInterval: number; encodedToken: string; } declare type ConnectCallback = GenericNodejsCallback; export declare class WSClientConnection extends WsConn { protected _connecting: boolean; private _connectResolve; private _connectCallback; protected _reconnectAttempt: number; parent: WSClient | WSServer; protected _options: WSClientConnectionOptions; constructor(options: WSClientConnectionOptions); protected onOpen(data: Buffer): void; protected onClose(reason: any): void; protected onError(err: NodeJSError): void; protected onMessage(data: Buffer): void; close(): void; _connect(): WebSocket; connect(cb?: ConnectCallback): Promise; _reconnect(cb?: ConnectCallback): Promise; delayedReconnect(cb?: ConnectCallback): Promise; } export interface WSClientOptions { ws: WebSocket; url: string; pingInterval: number; inactivityTimeout: number; reconnectInterval: number; encodedToken: string; } export declare class WSClient extends EventEmitter2 { conn: WSClientConnection; protected _options: WSClientOptions; protected _debug: Debug; constructor(options: WSClientOptions); _connect(cb?: GenericNodejsCallback): Promise; connect(cb?: GenericNodejsCallback): Promise; } export {};