@ryinner/web-socket-manager
Version:
simple ws manager
15 lines (14 loc) • 868 B
TypeScript
import WebSocketManager from './websocket';
import type { OperationsHandler, WebSocketManagerSettings, WebSocketSend } from './websocket.interface';
declare class WebSocketList<T> {
private readonly webSockets;
constructor(settings: Record<keyof T, WebSocketManagerSettings>);
getConnection(id: keyof T): WebSocketManager;
addOperation(id: keyof T, operationSetting: WebSocketSend): void;
removeOperation(id: keyof T, method: string): void;
removeHandler(id: keyof T, method: string, handler: OperationsHandler): void;
}
declare function createWebSocket<T extends Record<string, WebSocketManagerSettings>>(webSocketSettings: T): WebSocketList<T>;
declare function createWebSocket(webSocketSettings: WebSocketManagerSettings): WebSocketManager;
export default createWebSocket;
export declare const WS_DOESNT_EXISTS = "WebSocket doesn't exists";