import { WebSocket } from 'ws';
interface ServerResponseModel {
    messageId: number;
    hasError: boolean;
    data: any;
}
interface PackedSendOptions {
    passThrough?: boolean;
}
export declare class WebSocketManager {
    private _mainServer;
    private _messageBuffers;
    private _batchingTimers;
    private _maxMessageSize;
    private _messageDelay;
    private _webSockets;
    private _chunkThresholdBytes;
    private _chunkSizeBytes;
    private readonly _chunkMetaFlag;
    private _chunkingEnabled;
    private readonly _textDecoder;
    private _wsSendDebug;
    private _wsSendLogThresholdMs;
    private _wsSendLogBytes;
    private _wsSendLogBufferedBytes;
    private _packedChunkMinBytes;
    private _sendQueues;
    private _sendQueueTimers;
    private _sendThrottleMs;
    private _sendBackpressureBytes;
    private _sendMaxBatchesPerTick;
    private _aiWorkerDebug;
    private _wsBackpressureLogAt;
    private _wsBackpressureLogCooldownMs;
    constructor();
    static create(mainServer: any, maxMessageSize?: number, messageDelay?: number, chunkThresholdBytes?: number, chunkSizeBytes?: number): WebSocketManager;
    initialize(mainServer: any, maxMessageSize?: number, messageDelay?: number, chunkThresholdBytes?: number, chunkSizeBytes?: number): void;
    private parseDebugFlag;
    private parseBoolean;
    private parsePositiveInt;
    private isBackpressured;
    private shouldQueueSend;
    private maybeLogBackpressure;
    private getQueueDelayMs;
    private enqueueSend;
    private scheduleSendDrain;
    private drainSendQueue;
    private scheduleNextChunk;
    private shouldLogSend;
    private getBufferedAmount;
    private logWsSend;
    addWebSocket(ws: WebSocket): void;
    private isSocketActive;
    removeWebSocket(ws: WebSocket): void;
    getWebSocket(id_socket: string): WebSocket | undefined;
    getAllWebSockets(): WebSocket[];
    getActiveWebSocketCount(): number;
    getUserWebSockets(id_user: string): WebSocket[];
    send(ws: WebSocket, data: ServerResponseModel | string): void;
    sendPackedBuffer(ws: WebSocket, messageId: number, hasError: boolean, packedData: Uint8Array | Buffer, encoding?: 'msgpack' | 'json', options?: PackedSendOptions): void;
    private flushMessages;
    private sendMessagesInChunksBinary;
    private handleSendError;
    closeConnection(ws: WebSocket): void;
    private prepareChunkContext;
    private decodePackedPayload;
    private sendChunkSequence;
    private transmitBatch;
    private transmitBatchNow;
    private generateChunkId;
    private toBase64;
}
export {};
