import { BaseMessage, HandlerRequestData, InvokePrefixes, ISrpcLogger, RequestData, ResponseData, SrpcDisconnectCause, SrpcMessageFns, SrpcMeta } from './types';
export declare class SrpcConflictError extends Error {
    constructor();
}
export interface SrpcClientOptions {
    enableReconnect?: boolean;
    protocolVersion?: 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 ws?;
    private readonly streamConnectionHandlers;
    private readonly streamDisconnectionHandlers;
    private readonly streamMessageHandlers;
    private readonly requestQueue;
    private connectResolve?;
    private connectReject?;
    private reconnectionTimeout?;
    private pingInterval?;
    private lastPongMs;
    private intentionalDisconnect;
    private supersede;
    private streamId;
    private enableReconnect;
    private protocolVersion;
    isConnected: boolean;
    constructor(logger: ISrpcLogger, uri: string, clientMessage: SrpcMessageFns<TClientInput>, serverMessage: SrpcMessageFns<TServerOutput>, clientId: string, clientMeta?: SrpcMeta | undefined, clientSecret?: string | undefined, clientOptions?: SrpcClientOptions);
    connect(options?: {
        supersede?: boolean;
    }): Promise<void>;
    disconnect(): void;
    triggerConnectionCheck(): void;
    private handleInitialHandshake;
    private handleClose;
    private handleError;
    private handleDisconnect;
    private queueReconnect;
    private doPingPong;
    private handleMessage;
    private handleByteStreamOperation;
    private handleReply;
    private handleServerRequest;
    private generateWsUrl;
    private decodeMessage;
    private writeMessage;
    private writeMessageAsync;
    byteStream: {
        parentStreamId: string;
        write: (streamId: number, chunk: unknown) => Promise<void>;
        finish: (streamId: number) => void;
        destroy: (streamId: number, error?: unknown) => void;
        attachDisconnectHandler: (handler: () => void) => void;
        detachDisconnectHandler: (handler: () => void) => void;
        getBufferedAmount: () => number;
    };
    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>>;
}
//# sourceMappingURL=SrpcClient.d.ts.map