// eslint-disable-next-line
import { 
// @ts-ignore
UdpWebSocketClient, 
// @ts-ignore
type UdpWebSocketMessage, 
// @ts-ignore
type UdpWsReceiveHandler, 
// @ts-ignore
type UdpWsCloseHandler, 
// @ts-ignore
type UdpWsErrorHandler } from 'udp-react-stencil-component-library';
/**
 * Options for configuring the WebSocket connection behavior.
 */
interface UdpWebSocketHookOptions {
    /** Callback invoked when a message is received from the WebSocket server. */
    onMessageReceived?: UdpWsReceiveHandler;
    /** Callback invoked when a WebSocket error occurs. */
    onError?: UdpWsErrorHandler;
    /** Callback invoked when the WebSocket connection closes. */
    onClose?: UdpWsCloseHandler;
    /** Interval in seconds for sending keep-alive pings. Set to 0 to disable. */
    keepAliveIntervalSec?: number;
    /** Timeout in minutes before automatically closing an idle connection. Set to 0 to disable. */
    keepAliveTimeoutMin?: number;
}
/**
 * React hook for managing WebSocket connections with automatic connection handling,
 * keep-alive support, and message management.
 *
 * @param url - The WebSocket URL to connect to (ws:// or wss://). If undefined, no connection is established.
 * @param options - Configuration options for the WebSocket connection behavior.
 *
 * @returns An object containing:
 * - `connected`: Boolean indicating if the WebSocket is currently connected
 * - `lastMessage`: The most recent message received from the server
 * - `lastError`: The most recent error event
 * - `send`: Async function to send messages (auto-connects if not connected)
 * - `reconnect`: Async function to manually reconnect the WebSocket
 * - `close`: Function to close the WebSocket connection
 * - `client`: Direct access to the underlying UdpWebSocketClient instance
 *
 * @example
 * ```tsx
 * // Basic usage
 * const { connected, send } = useUdpWebSocket(
 *   'wss://localhost:44371/UemService/api/v1/UdpWebSocket/21f2060a-1a09-4a03-81aa-4179db30b4eb/connect'
 * );
 *
 * const handleSend = () => {
 *   send({ payload: { message: "Hello world" } });
 * };
 * ```
 *
 * @example
 * ```tsx
 * // With message handling and keep-alive
 * const { connected, lastMessage, send } = useUdpWebSocket(
 *   'wss://localhost:44371/UemService/api/v1/UdpWebSocket/21f2060a-1a09-4a03-81aa-4179db30b4eb/connect',
 *   {
 *     onMessageReceived: (msg) => {
 *       console.log('Received:', msg);
 *     },
 *     onError: (error) => {
 *       console.error('WebSocket error:', error);
 *     },
 *     onClose: () => {
 *       console.log('Connection closed');
 *     },
 *     keepAliveIntervalSec: 30,  // Send ping every 30 seconds
 *     keepAliveTimeoutMin: 10     // Auto-close after 10 minutes
 *   }
 * );
 *
 * useEffect(() => {
 *   if (lastMessage) {
 *     // Handle received message
 *   }
 * }, [lastMessage]);
 * ```
 *
 * @remarks
 * - The hook automatically establishes a connection when the URL is provided
 * - Authentication tokens are automatically retrieved via `getAccessToken()`
 * - The `send()` function will automatically connect if not already connected
 * - Calling `close()` will close the connection; it will not auto-reconnect unless `reconnect()` is called
 * - The connection is automatically cleaned up when the component unmounts
 * - Keep-alive pings help maintain long-lived connections and detect dead connections
 */
export declare function useUdpWebSocket(url?: string, options?: UdpWebSocketHookOptions): {
    connected: boolean;
    lastMessage: UdpWebSocketMessage;
    lastError: Event;
    send: (msg: UdpWebSocketMessage) => Promise<void>;
    reconnect: () => Promise<void>;
    close: () => void;
    client: UdpWebSocketClient;
};
export {};
//# sourceMappingURL=useUdpWebSocket.d.ts.map