///
import * as events from 'events';
export interface HealthCheckConfig {
enabled: boolean;
pingInterval?: number;
maxMissedPongs?: number;
}
export interface WebSocketClientOptions {
url: string;
apiKey?: string;
bearerToken?: string;
sdkToken?: string;
healthCheck?: HealthCheckConfig;
}
export interface DisconnectReason {
reason: 'health-check-timeout';
}
export declare class WebSocketClient extends events.EventEmitter {
protected readonly options: WebSocketClientOptions;
private socket;
private consecutiveMisses;
private lastMessageAt;
private lastPingAt;
private pingTimerId;
private pendingDisconnectReason;
constructor(options: WebSocketClientOptions);
/**
* The endpoint this client connects to, fully resolved — host, version
* segment, product and `/streaming`.
*
* The version segment is chosen by the SDK from the `version` option rather
* than written by the caller, so this is the only way to see which version a
* client actually ended up on.
*/
get url(): string;
connect(): Promise;
disconnect(): void;
private detectConnectionStatus;
subscribe(params: {
channel: string;
[key: string]: any;
}): void;
unsubscribe(params: {
id?: string;
ids?: string[];
}): void;
ping(params: {
state?: any;
}): void;
subscriptions(): void;
private authenticate;
private send;
private handleMessage;
}