import { IByteStream } from './SrpcByteStream';
import { BaseMessage, HandlerRequestData, InvokePrefixes, ISrpcLogger, RequestData, ResponseData, SrpcDisconnectCause, SrpcMessageFns, SrpcMeta, SrpcTrafficLogging } from './types';
export declare class SrpcConflictError extends Error {
    constructor();
}
export interface SrpcClientOptions {
    enableReconnect?: boolean;
    logTraffic?: SrpcTrafficLogging;
    /** Audience signed into canonical credentials. Defaults to the WebSocket path. */
    authAudience?: string;
    /** Advertise support for associating byte-stream senders with a handler request. */
    senderAnnouncements?: boolean;
    maxPendingRequests?: number;
    maxPendingRequestBytes?: number;
    maxInFlightServerRequests?: number;
    maxInFlightServerRequestBytes?: number;
    maxBufferedBytes?: number;
    maxMessageBytes?: number;
    /** Full WebSocket handshake + activation timeout. Defaults to 60 seconds. */
    connectTimeoutMs?: number;
    /** How long replies for locally abandoned requests are ignored. Defaults to 60 seconds. */
    lateReplyTombstoneTtlMs?: number;
}
export declare class SrpcClient<TClientInput extends BaseMessage = BaseMessage, TServerOutput extends BaseMessage = BaseMessage> {
    private readonly logger;
    private readonly uri;
    private readonly clientMessage;
    private readonly serverMessage;
    private readonly clientId;
    private readonly clientMeta?;
    private readonly clientSecret?;
    private readonly clientOptions?;
    private readonly handlerRequestId;
    private ws?;
    private readonly streamConnectionHandlers;
    private readonly streamDisconnectionHandlers;
    private readonly streamMessageHandlers;
    private readonly requestQueue;
    private readonly requestBytes;
    private readonly lateReplyTombstones;
    private connectResolve?;
    private connectReject?;
    private reconnectionTimeout?;
    private pingInterval?;
    private lastPongMs;
    private intentionalDisconnect;
    private supersede;
    private hasEstablishedGeneration;
    private streamId;
    private enableReconnect;
    private senderAnnouncements;
    private generation;
    private readonly handlerPressureByGeneration;
    private readonly byteStreamsByGeneration;
    private readonly byteStreamPressureByGeneration;
    private readonly byteStreamDisconnectHandlersByGeneration;
    private awaitingActivation?;
    private clearConnectTimeout?;
    isConnected: boolean;
    constructor(logger: ISrpcLogger, uri: string, clientMessage: SrpcMessageFns<TClientInput>, serverMessage: SrpcMessageFns<TServerOutput>, clientId: string, clientMeta?: SrpcMeta | undefined, clientSecret?: string | undefined, clientOptions?: SrpcClientOptions | undefined);
    connect(options?: {
        supersede?: boolean;
    }): Promise<void>;
    disconnect(): void;
    triggerConnectionCheck(): void;
    private handleInitialHandshake;
    private completeConnection;
    private handleClose;
    private handleError;
    private revokeGeneration;
    private closeGenerationWithError;
    private queueReconnect;
    private doPingPong;
    private handleMessage;
    private handleByteStreamOperation;
    private handleReply;
    private handleServerRequest;
    private generateWsUrl;
    private decodeMessage;
    private writeMessage;
    private writeEncodedMessage;
    private writeMessageAsync;
    private currentByteStream;
    private logTraffic;
    private logData;
    get byteStream(): IByteStream;
    private createByteStream;
    resolveByteStream(): IByteStream;
    private revokeByteStreamGeneration;
    registerConnectionHandler(handler: () => void): void;
    registerMessageHandler<P extends InvokePrefixes<TServerOutput, TClientInput>>(prefix: P, handler: (data: HandlerRequestData<TServerOutput, P>) => Promise<ResponseData<TClientInput, P>> | ResponseData<TClientInput, P>): void;
    registerDisconnectHandler(handler: (cause: SrpcDisconnectCause) => void): void;
    invoke<P extends InvokePrefixes<TClientInput, TServerOutput>>(prefix: P, data: RequestData<TClientInput, P>, timeoutMs?: number): Promise<ResponseData<TServerOutput, P>>;
    private isCurrent;
    private rejectAllRequests;
    private validRemoteByteStreamOperation;
    private getByteStreamPressureState;
    private updateByteStreamBufferedBytes;
    private clearByteStreamPressure;
    private totalByteStreamBufferedBytes;
    private addLateReplyTombstone;
    private isLateReply;
    private pruneLateReplyTombstones;
    private get lateReplyTombstoneTtlMs();
    private get pendingRequestBytes();
    private get maxPendingRequests();
    private get maxPendingRequestBytes();
    private get maxInFlightServerRequests();
    private get maxInFlightServerRequestBytes();
    private get maxBufferedBytes();
    private get maxMessageBytes();
    private get connectTimeoutMs();
}
//# sourceMappingURL=SrpcClient.d.ts.map