import { WebsocketTopics } from '../models/models'; export declare class WebsocketService { /** The main websocket connection to Aspera App*/ private globalSocket; /** A map of requested subscription names and the callback for them */ private sockets; /** The callback for websocket events */ private eventListener; /** Indicator if the websocket is already connected */ private isConnected; /** When true, the reconnect loop is suppressed */ private stopped; /** When true, the connection/reconnect loop is already running */ private active; /** ID of the pending reconnect timer (so it can be cancelled) */ private reconnectTimerId; /** Global promise object that resolves when init completes */ private initPromise; /** Log call for not being ready */ private handleNotReady; /** * This function handles when a connection is opened */ private handleOpen; /** * This function handles completed subscription */ private handleClose; /** * This function handles errors received from the websocket */ private handleError; /** * This function handles messages received from the websocket */ private handleMessage; /** * This function joins the channel to be able to subscribe to events */ private joinChannel; /** * This function registers clients to listen to a certain message name. Returns any to allow functions to declare proper type * * @param messageName - the name of messages to listen to (one message name per subscription) * @param callback - the callback function */ registerMessage(messageName: WebsocketTopics, callback: Function): void; /** * * @param callback This function registers clients to a certain WebSocket event. * * @param callback - the callback function to call with the event name. */ registerEvent(callback: Function): void; /** * This function starts the websocket subscription with the websocket provider * * @returns a promise that resolves when the websocket connection is established */ init(): Promise; /** * Stop the WebSocket connection and suppress the automatic reconnect loop. * Used when falling back to a different transfer client (e.g. Connect). */ disconnect(): void; private connect; /** * Detach event handlers from the current socket so it cannot fire * stale CLOSED/RECONNECT events after being replaced. */ private detachSocket; private reconnect; private getWebSocketConnection; private notifyEvent; private updateRpcPort; } export declare const websocketService: WebsocketService; export default WebsocketService;