/** * WebSocket Server Implementation * Provides real-time updates for simulator data and events */ import { Server } from "socket.io"; import { Server as HTTPServer } from "http"; interface ClientInfo { id: string; connectedAt: Date; subscriptions: Set; } interface BroadcastData { simulatorId?: string; templateId?: string; address?: string; value?: unknown; values?: Record; [key: string]: unknown; } declare class WebSocketServer { private io; private httpServer; private clients; private simulatorSubscriptions; private broadcastHook?; constructor(httpServer: HTTPServer); initialize(opts?: { broadcastHook?: (event: string, data: BroadcastData) => void; }): void; /** * Get the underlying Socket.IO server instance */ getIO(): Server | null; private setupEventHandlers; private subscribeToSimulator; private unsubscribeFromSimulator; private handleDisconnect; /** * Broadcast an event to all connected clients */ broadcast(event: string, data: BroadcastData): void; /** * Send event to specific simulator subscribers */ broadcastToSimulator(simulatorId: string, event: string, data: Record): void; /** * Get statistics about connected clients */ getStats(): { totalClients: number; totalSubscriptions: number; simulatorSubscriptions: Record; }; /** * Get list of connected clients */ getClients(): ClientInfo[]; /** * Check if server is initialized */ isInitialized(): boolean; /** * Shutdown the WebSocket server */ shutdown(): Promise; } /** * Create WebSocket server instance */ export declare function createWebSocketServer(httpServer: HTTPServer, opts?: { reset?: boolean; broadcastHook?: (event: string, data: BroadcastData) => void; }): WebSocketServer; /** * Get existing WebSocket server instance */ export declare function getWebSocketServer(): WebSocketServer | null; /** * Export the class for type usage */ export { WebSocketServer }; export type { ClientInfo, BroadcastData }; //# sourceMappingURL=websocketServer.d.ts.map