import { LoggerInterface } from '@deepkit/logger';
import { BaseMessage, HandlerRequestData, InvokePrefixes, RequestData, ResponseData, SrpcMessageFns, SrpcMeta } from './types';
export interface SrpcClientOptions {
    enableReconnect?: boolean;
}
export declare class SrpcClient<TClientInput extends BaseMessage = BaseMessage, TServerOutput extends BaseMessage = BaseMessage> {
    private logger;
    private uri;
    private clientId;
    private clientMeta?;
    private clientSecret?;
    private ws?;
    private outboundType;
    private inboundType;
    private streamConnectionHandlers;
    private streamMessageHandlers;
    private streamDisconnectionHandlers;
    private reconnectionTimeout?;
    private pingInterval?;
    private lastPongMs?;
    private requestQueue;
    private enableReconnect;
    private intentionalDisconnect;
    private streamId;
    isConnected: boolean;
    constructor(logger: LoggerInterface, uri: string, 
    /** ts-proto generated ClientMessage type with encode/decode */
    clientMessage: SrpcMessageFns<TClientInput>, 
    /** ts-proto generated ServerMessage type with encode/decode */
    serverMessage: SrpcMessageFns<TServerOutput>, clientId: string, clientMeta?: SrpcMeta | undefined, clientSecret?: string | undefined, clientOptions?: SrpcClientOptions);
    connect(): void;
    disconnect(): void;
    /**
     * Trigger an immediate connection health check.
     * Sends a ping and expects a pong before the next scheduled ping interval,
     * otherwise the connection will be reset due to pong timeout.
     */
    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;
    byteStream: {
        parentStreamId: string;
        write: (streamId: number, chunk: any) => boolean;
        finish: (streamId: number) => void;
        destroy: (streamId: number, err?: any) => void;
        attachDisconnectHandler: (handler: () => void) => void;
        detachDisconnectHandler: (handler: () => void) => void;
        getBufferedAmount: () => number;
    };
    registerConnectionHandler(handler: () => void): void;
    /**
     * Register a handler for server requests (downstream/server-initiated).
     * @example client.registerMessageHandler('dNotify', async (data) => ({ acknowledged: true }))
     */
    registerMessageHandler<P extends InvokePrefixes<TServerOutput, TClientInput>>(prefix: P, handler: (data: HandlerRequestData<TServerOutput, P>) => Promise<ResponseData<TClientInput, P>>): void;
    registerDisconnectHandler(handler: () => void): void;
    /**
     * Invoke a server method.
     * @example client.invoke('uEcho', { message: 'hello' })
     */
    invoke<P extends InvokePrefixes<TClientInput, TServerOutput>>(prefix: P, data: RequestData<TClientInput, P>, timeoutMs?: number): Promise<ResponseData<TServerOutput, P>>;
}
export declare type __ΩSrpcClientOptions = any[];
//# sourceMappingURL=SrpcClient.d.ts.map