import type { RosbridgeClientOptions, ConnectionStatus, RosbridgeMessage, MessageHandler, ConnectionHandler } from "./types.js"; /** Pending request/response tracker for service calls and action goals. */ export interface PendingRequest { resolve: (value: unknown) => void; reject: (reason: Error) => void; timer: ReturnType; } /** * WebSocket client for the rosbridge protocol. * Handles connection lifecycle, reconnection, and message routing. */ export declare class RosbridgeClient { private ws; private options; private status; private messageHandlers; private connectionHandlers; private pendingRequests; private reconnectAttempts; private reconnectTimer; private intentionalClose; private idCounter; constructor(options: RosbridgeClientOptions); /** Connect to the rosbridge WebSocket server. */ connect(): Promise; /** Disconnect from the rosbridge server. */ disconnect(): Promise; /** Send a rosbridge protocol message. */ send(message: RosbridgeMessage & Record): void; /** Generate a unique message ID. */ nextId(prefix?: string): string; /** Subscribe to messages on a specific topic. */ onMessage(topic: string, handler: MessageHandler): () => void; /** Register a connection status change handler. */ onConnection(handler: ConnectionHandler): () => void; /** Get current connection status. */ getStatus(): ConnectionStatus; /** * Register a pending request that will be resolved when a response * with the matching ID arrives (service_response or action_result). */ registerPending(id: string, resolve: (value: unknown) => void, reject: (reason: Error) => void, timeoutMs?: number): void; /** Resolve a pending request by ID and clean up. */ resolvePending(id: string, result: unknown): void; /** Reject a pending request by ID and clean up. */ rejectPending(id: string, error: Error): void; private setStatus; /** Route an incoming rosbridge message to the appropriate handler. */ private handleMessage; /** Attempt to reconnect with exponential backoff. */ private attemptReconnect; /** Reject all pending requests (used on disconnect/close). */ private rejectAllPending; } //# sourceMappingURL=client.d.ts.map