UNPKG

@liskhq/lisk-api-client

Version:
21 lines (20 loc) 740 B
import { EventCallback } from './types'; export declare const CONNECTION_TIMEOUT = 5000; export declare const RESPONSE_TIMEOUT = 10000; export declare class WSChannel { isAlive: boolean; private readonly _url; private _ws?; private _requestCounter; private _pendingRequests; private readonly _emitter; constructor(url: string); connect(): Promise<void>; disconnect(): Promise<void>; invoke<T = Record<string, unknown>>(actionName: string, params?: Record<string, unknown>): Promise<T>; subscribe<T = Record<string, unknown>>(eventName: string, cb: EventCallback<T>): void; unsubscribe(eventName: string): void; private _handleClose; private _handlePing; private _handleMessage; }