import { IMessage, StompSubscription } from '@stomp/stompjs'; export interface WebSocketOptions { reconnectDelay?: number; maxReconnectAttempts?: number; heartbeatIncoming?: number; heartbeatOutgoing?: number; debug?: boolean; connectionHeaders?: { [key: string]: string; }; } declare class WebSocket { private static instances; /** * 获取单例实例的唯一入口 * @param url WebSocket 服务器地址 * @param options 配置项 * @returns 返回对应 URL 的唯一 WebSocket 实例 */ static getInstance(url: string, options?: WebSocketOptions): WebSocket; /** * 私有构造函数 * 防止外部直接使用 new WebSocket() 导致单例失效 */ private constructor(); private url; private client; private subscriptions; private operationQueue; private state; private reconnectAttempts; private reconnectTimer; private connectPromises; private config; connect(): Promise; subscribe(topic: string, params: { [key: string]: any; }, callback: (message: T, rawMessage: IMessage) => void): Promise; private _doSubscribe; send(destination: string, body: any): void; unsubscribe(topic: string): boolean; unsubscribeAll(): void; disconnect(): void; getSubscriptionCount(): number; private _restoreSubscriptions; private _flushQueue; private _scheduleReconnect; isConnected(): boolean; getSubscribedTopics(): string[]; } export default WebSocket; //# sourceMappingURL=web-socket.d.ts.map