/**
 * WebSocket Client for NeuroLink SDK
 *
 * Provides a dedicated WebSocket client for real-time streaming connections
 * to NeuroLink servers. Supports bidirectional communication, automatic
 * reconnection, and message queuing.
 *
 * @module @neurolink/client/wsClient
 */
import type { ClientStreamCallbacks, WebSocketEventHandlers, ClientClientWebSocketState, ClientWebSocketMessage, ClientWebSocketConfig } from "../types/index.js";
/**
 * WebSocket streaming client for NeuroLink
 *
 * Provides real-time bidirectional communication with NeuroLink servers.
 *
 * @example Basic usage
 * ```typescript
 * const wsClient = new NeuroLinkWebSocket({
 *   baseUrl: 'wss://api.neurolink.example.com/ws',
 *   apiKey: 'your-api-key',
 * });
 *
 * wsClient.connect({
 *   onMessage: (event) => console.log('Received:', event),
 *   onError: (error) => console.error('Error:', error),
 * });
 *
 * // Send a message
 * wsClient.send({
 *   type: 'message',
 *   channel: 'chat',
 *   payload: { prompt: 'Hello!' },
 * });
 * ```
 */
export declare class NeuroLinkWebSocket {
    private ws;
    private config;
    private state;
    private reconnectAttempts;
    private heartbeatTimer;
    private messageQueue;
    private eventHandlers;
    private subscriptions;
    private pendingAuth;
    /**
     * Active OTel span for the current WebSocket connection lifecycle.
     * Created at connect() and ended on close/error so we capture connection
     * lifetime, reconnect counts, and error attribution in Langfuse.
     */
    private connectionSpan;
    /**
     * Local flag to suppress reconnection during an explicit disconnect().
     * Unlike mutating config.autoReconnect, this preserves the user's
     * original configuration so that a subsequent connect() still honours it.
     */
    private disconnectRequested;
    constructor(config: ClientWebSocketConfig);
    /**
     * Get current connection state
     */
    getState(): ClientClientWebSocketState;
    /**
     * Check if connected
     */
    isConnected(): boolean;
    /**
     * Connect to WebSocket server
     */
    connect(handlers?: WebSocketEventHandlers): void;
    /**
     * Disconnect from WebSocket server
     *
     * Sets a local flag to prevent the onclose handler from triggering
     * reconnection, without mutating the shared config.
     */
    disconnect(): void;
    /**
     * Send a message through WebSocket
     */
    send(message: ClientWebSocketMessage): void;
    /**
     * Subscribe to a channel with streaming callbacks
     */
    subscribe(channel: string, callbacks: ClientStreamCallbacks): void;
    /**
     * Unsubscribe from a channel
     */
    unsubscribe(channel: string): void;
    /**
     * Stream a prompt with callbacks
     */
    stream(prompt: string, options?: {
        channel?: string;
    } & ClientStreamCallbacks): void;
    private setupEventListeners;
    private handleMessage;
    private dispatchToCallbacks;
    private setState;
    private startHeartbeat;
    private stopHeartbeat;
    private attemptReconnect;
    private flushMessageQueue;
    /**
     * Re-send subscribe messages for every active subscription.
     * Called after a successful reconnect so that channel listeners
     * resume working without the caller needing to re-subscribe manually.
     */
    private replaySubscriptions;
}
/**
 * Create a WebSocket client instance
 *
 * @example
 * ```typescript
 * const client = createWebSocketClient({
 *   baseUrl: 'wss://api.neurolink.example.com/ws',
 *   apiKey: 'your-api-key',
 *   autoReconnect: true,
 * });
 *
 * client.connect({
 *   onMessage: (event) => console.log('Received:', event),
 * });
 * ```
 */
export declare function createWebSocketClient(config: ClientWebSocketConfig): NeuroLinkWebSocket;
