/**
 * WebSocket client for connecting to the gateway server.
 *
 * Handles connection lifecycle, message sending/receiving,
 * ping/pong heartbeat responses, and automatic reconnection
 * with exponential backoff.
 */
import type { Message } from "@pocketcoder/shared";
import type { ConnectionState, GatewayClientEvents, GatewayClientOptions } from "./types.js";
type EventName = keyof GatewayClientEvents;
export declare class GatewayClient {
    private ws;
    private _state;
    private listeners;
    private url;
    private autoReconnect;
    private reconnectBaseMs;
    private reconnectMaxMs;
    private reconnectAttempt;
    private reconnectTimer;
    private manualDisconnect;
    constructor(options: GatewayClientOptions);
    /** Current connection state */
    get state(): ConnectionState;
    /** Register an event listener */
    on<E extends EventName>(event: E, listener: GatewayClientEvents[E]): this;
    /** Remove an event listener */
    off<E extends EventName>(event: E, listener: GatewayClientEvents[E]): this;
    /** Emit an event to all registered listeners */
    private emit;
    /** Connect to the gateway server */
    connect(): void;
    /** Set up a new WebSocket connection and its event handlers */
    private setupWebSocket;
    /** Schedule a reconnection attempt with exponential backoff */
    private scheduleReconnect;
    /** Send a typed message to the gateway */
    send(message: Message): void;
    /** Send any JSON-serializable object to the gateway */
    private sendJson;
    /** Disconnect from the gateway server gracefully */
    disconnect(): void;
    /** Check if the client is currently connected */
    get connected(): boolean;
    /**
     * Send a WebSocket ping and wait for pong response.
     * Uses WebSocket protocol-level ping/pong for true end-to-end verification.
     *
     * @param timeoutMs - Maximum time to wait for pong (default 3000ms)
     * @returns true if pong received within timeout, false otherwise
     */
    ping(timeoutMs?: number): Promise<boolean>;
}
export {};
//# sourceMappingURL=websocket-client.d.ts.map