neochat-widget
Version:
Universal JavaScript SDK and Widget for NeoChat AI Assistant
23 lines (22 loc) • 663 B
TypeScript
type WebSocketEvent = 'message' | 'error' | 'close' | 'open';
type EventHandler = (data: any) => void;
export declare class WebSocketClient {
private url;
private apiKey;
private businessId;
private socket;
private eventHandlers;
private reconnectAttempts;
private maxReconnectAttempts;
private reconnectDelay;
private isConnecting;
private shouldReconnect;
constructor(url: string, apiKey: string, businessId: string);
private initialize;
on(event: WebSocketEvent, handler: EventHandler): () => void;
send(data: any): void;
close(): void;
get isConnected(): boolean;
private emit;
}
export {};