UNPKG

treesap

Version:
48 lines 1.55 kB
import { WebSocket } from 'ws'; import type { Server } from 'http'; export interface WebSocketClient { id: string; ws: WebSocket; sessionId?: string; terminalId?: string; lastPing: Date; } export interface WebSocketMessage { type: 'join' | 'leave' | 'input' | 'resize' | 'ping' | 'pong'; sessionId?: string; terminalId?: string; data?: string; cols?: number; rows?: number; timestamp?: number; } export declare class WebSocketTerminalService { private static wss; private static clients; private static sessionClients; static initialize(server: Server): void; private static setupPingPong; private static handleMessage; private static handleJoin; private static handleLeave; private static handleInput; private static handleResize; private static handleDisconnect; private static addClientToSession; private static removeClientFromSession; private static setupSessionOutputListener; private static cleanupSessionOutputListener; private static broadcastToSession; private static broadcastClientCount; private static sendToClient; static getSessionClients(sessionId: string): string[]; static sendCommandToSession(sessionId: string, command: string): boolean; static getActiveSessions(): Array<{ sessionId: string; clientCount: number; }>; static getConnectedClients(): number; static closeSession(sessionId: string): void; static cleanup(): void; } //# sourceMappingURL=websocket.d.ts.map