UNPKG

@qrvey/websocket-client

Version:

![install size](https://packagephobia.com/badge?p=@qrvey/websocket-client)

39 lines (37 loc) 1.11 kB
declare enum SOCKET_STATUS { CONNECTED = "CONNECTED", ACTIVE = "ACTIVE", RECOVERED = "RECOVERED", DISCONNECTED = "DISCONNECTED", UNDEFINED = "UNDEFINED" } declare class WebSocketClient { private socket; private intervalPingPongId; constructor(auth: { userId?: string; clientId?: string; token?: string; apiKey?: string; }, { domain, isAutoPingPongEnable, ignoreClientId, }?: { domain?: string; isAutoPingPongEnable?: boolean; ignoreClientId?: boolean; }); publish({ eventName, data, isPublic, }: { eventName: string; data: Record<string, any>; isPublic?: boolean; }): void; publishAndDisconnect({ eventName, data, isPublic, }: { eventName: string; data: Record<string, any>; isPublic?: boolean; }): void; subscribe(eventName: string, callback: (message: any) => void): this; onError(callback: (message: any) => void): void; status(): SOCKET_STATUS; connect(): void; disconnect(): void; } export { SOCKET_STATUS, WebSocketClient };