import { EventEmitter } from 'events'; import { AgentConnection, ServerConfig, ConnectionStats } from '../types'; import { SecurityMiddleware, SecurityConfig } from '../security'; /** * High-performance WebSocket server for agent connections * Handles connection lifecycle, heartbeat, reconnection logic, and security */ export declare class WebSocketServer extends EventEmitter { private wss; private connections; private heartbeatInterval; private config; private security; private stats; constructor(config: ServerConfig, securityConfig?: SecurityConfig); /** * Start the WebSocket server */ start(): Promise; /** * Handle new WebSocket connection */ private handleConnection; /** * Handle incoming message from agent */ private handleMessage; /** * Handle pong response (heartbeat) */ private handlePong; /** * Handle connection close */ private handleDisconnection; /** * Handle WebSocket error */ private handleError; /** * Start heartbeat mechanism (ping/pong) */ private startHeartbeat; /** * Send message to specific connection */ sendToConnection(connectionId: string, message: any): boolean; /** * Send message to specific agent */ sendToAgent(agentId: string, message: any): boolean; /** * Broadcast message to all connected agents */ broadcast(message: any, excludeConnectionId?: string): void; /** * Send error message to connection */ private sendError; /** * Update agent information for a connection */ updateAgentInfo(connectionId: string, agentId: string, capabilities: string[]): boolean; /** * Get connection by ID */ getConnection(connectionId: string): AgentConnection | undefined; /** * Get all active connections */ getConnections(): AgentConnection[]; /** * Get connection statistics */ getStats(): ConnectionStats; /** * Generate unique connection ID */ private generateConnectionId; /** * Stop the WebSocket server */ stop(): Promise; /** * Get security middleware (for key management) */ getSecurity(): SecurityMiddleware | null; } //# sourceMappingURL=WebSocketServer.d.ts.map