import { HttpError } from '@microsoft/signalr'; /** * Socket message flags. These can be combined. */ export declare enum SocketMessageFlags { None = 0, Data = 1, Progress = 2, Completed = 4, Error = 8, ConnectionError = 16, Exception = 32 } /** * Socket message. */ export interface SocketMessage { type: SocketMessageFlags; connectionError?: HttpError; message: T; } /** * SignalR based socket class. */ export declare abstract class SocketSignalR { private gatewayUrl; private connectionUrl; private connection; private started; private lastError; private processHandler; /** * Gets signalR connection URL. */ private get url(); /** * Instantiates a new instance of the SocketSignalR class. */ constructor(gatewayUrl: string, connectionUrl: string); /** * Subscribe to the proxy with method name and handler. * * @param name the name of subscription for a method. */ subscribe(name: string): void; /** * Unsubscribe to the subscribed method call. * * @param name the name of subscription for a method. */ unsubscribe(name: string): void; /** * Start request connection. */ start(): Promise; /** * Stop request connection. */ stop(): void; /** * Invoke a method with parameters. * * @param name the method name to execute. * @param args the parameters to pass. * @return Promise the promise object. */ invoke(name: string, ...args: any[]): Promise; /** * The client handler. */ protected abstract clientHandler(messages: SocketMessage): void; /** * Process the message. * * @param messages the messages. */ protected abstract processMessage(message: string): void; /** * Initiate the connection to gateway. */ private init; /** * Error message from signalr connection. * * @param error the error produced on the connection. */ private errorMessage; }