import { TConnectionState, TDebugEvent, TIncomingData, TManagerConfig, TManagerSnapshot, TSendFailedParams, TSendParams, TWireData } from './types'; export declare class WebSocketManager, TKey extends string = "type", TWire extends TWireData = string, TIncoming extends TIncomingData = string> { readonly discriminator: TKey; private readonly urlStatic; private readonly urlDynamic; private readonly transport; private readonly serialize; private readonly deserialize; private readonly pingIntervalMs; private readonly pongTimeoutMs; private readonly pauseHeartbeatWhenHidden; private readonly reconnectMaxAttempts; private readonly reconnectBaseDelayMs; private readonly reconnectMaxDelayMs; private readonly ping; private readonly isPong; private readonly getAckIdCb; private readonly getSubscriptionResolvedKeyCb; private readonly onReady; private readonly onDebugCb; private readonly subscriptionRefCounts; private readonly subscriptionData; private readonly pendingSubscriptions; private readonly inFlightMessages; private readonly connectionStateListeners; private readonly messageListeners; private readonly keyedMessageListeners; private readonly pendingSubscriptionListeners; private readonly sendIntentListeners; private readonly sendFailedListeners; private readonly inFlightDropListeners; private readonly readyListeners; private readonly lastUnsubscribeListeners; private readonly debugListeners; private protocols; private connectionState; private reconnectAttempt; private reconnectTimer; private pingTimer; private pongTimer; private intentionalClose; private disposed; private debugEventCounter; private connectAttemptId; private windowListenersAttached; constructor(config: TManagerConfig); connect(): void; private initiateTransportConnect; private resolveDynamicUrl; disconnect(): void; forceReconnect(): void; dispose(): void; subscribe(key: string, data?: TClientMsg): void; unsubscribe(key: string, data?: TClientMsg): void; getRefCount(key: string): number; hasPendingSubscription(key: string): boolean; addPendingSubscriptionListener(listener: () => void): () => void; ackInFlight(ackId: string): void; resolvePendingSubscription(key: string): void; send(params: TSendParams): boolean; getConnectionState(): TConnectionState; addConnectionStateListener(listener: () => void): () => void; /** * Firehose: invoked for every parsed server message. Use for the * inspector, logging, or catch-all bridges. For per-type handlers, * prefer `addEventListener(value, cb)` — it dispatches in O(1) by the * configured discriminator instead of fanning out to every listener. */ addMessageListener(cb: (msg: TServerMsg) => void): () => void; /** * Keyed dispatch: invoke `cb` only when the incoming message's * discriminator value equals `value`. O(1) per frame instead of O(N). * `useSocketEvent` and `useSocketEventBatch` use this internally. */ addEventListener(value: string, cb: (msg: TServerMsg) => void): () => void; addSendIntentListener(cb: (params: TSendParams) => void): () => void; addSendFailedListener(cb: (params: TSendFailedParams) => void): () => void; addInFlightDropListener(cb: (messages: { id: string; data: TClientMsg; }[]) => void): () => void; addReadyListener(cb: (restoredKeys: string[]) => void): () => void; addLastUnsubscribeListener(cb: (key: string, data: TClientMsg | undefined) => void): () => void; addDebugListener(cb: (event: TDebugEvent) => void): () => void; /** * Returns a single-read view of the manager's internal state. Use this * for the Inspector or for tests that need to assert across multiple * collections without juggling separate accessors. The returned Maps and * Set are typed Readonly but reference the live internal collections; * clone them before retaining. */ getSnapshot(): TManagerSnapshot; private handleOpen; private handleClose; private handleMessage; private handleOnline; private handleOffline; private handleVisibilityChange; private detachTransportHandlers; private scheduleReconnect; private restoreSubscriptions; private firePing; private handlePongTimeout; private startPingInterval; private clearPongTimeout; private rawSend; private emitSendFailed; private sendSubscribe; private setConnectionState; private clearPendingSubscriptions; private dropInFlight; private emitDebug; private clearTimers; /** * Replace the WebSocket subprotocols offered on the next connect. * Pass an empty array to drop them. */ setProtocols(protocols: readonly string[]): void; private addWindowListeners; private removeWindowListeners; } //# sourceMappingURL=manager.d.ts.map