UNPKG

@push.rocks/smartproxy

Version:

A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, dynamic routing with authentication options, and automatic ACME certificate management.

39 lines (38 loc) 1.14 kB
import * as plugins from '../plugins.js'; import { type INetworkProxyOptions } from './classes.np.types.js'; import { ConnectionPool } from './classes.np.connectionpool.js'; import { ProxyRouter } from '../classes.router.js'; /** * Handles WebSocket connections and proxying */ export declare class WebSocketHandler { private options; private connectionPool; private router; private heartbeatInterval; private wsServer; private logger; constructor(options: INetworkProxyOptions, connectionPool: ConnectionPool, router: ProxyRouter); /** * Initialize WebSocket server on an existing HTTPS server */ initialize(server: plugins.https.Server): void; /** * Start the heartbeat interval to check for inactive WebSocket connections */ private startHeartbeat; /** * Handle a new WebSocket connection */ private handleWebSocketConnection; /** * Get information about active WebSocket connections */ getConnectionInfo(): { activeConnections: number; }; /** * Shutdown the WebSocket handler */ shutdown(): void; }