import type { MaybeRefOrGetter } from './_shared'; import type { Ref } from '@stacksjs/stx'; /** * Reactive WebSocket connection. * * @param url - The WebSocket URL (can be a ref, getter, or raw string) * @param options - Configuration options * @returns Reactive WebSocket state and control methods * * @example * ```ts * const { data, status, send, close } = useWebSocket('ws://localhost:8080', { * onConnected(ws) { console.log('Connected') }, * onMessage(ws, event) { console.log('Message:', event.data) }, * autoReconnect: { retries: 3, delay: 1000 }, * }) * ``` */ export declare function useWebSocket(url: MaybeRefOrGetter, options?: UseWebSocketOptions): UseWebSocketReturn; export declare interface UseWebSocketOptions { onConnected?: (ws: WebSocket) => void onDisconnected?: (ws: WebSocket, event: CloseEvent) => void onError?: (ws: WebSocket, event: Event) => void onMessage?: (ws: WebSocket, event: MessageEvent) => void immediate?: boolean autoReconnect?: boolean | { retries?: number, delay?: number } heartbeat?: boolean | { interval?: number, message?: string } protocols?: string | string[] } export declare interface UseWebSocketReturn { data: Ref status: Ref ws: Ref open: () => void close: (code?: number, reason?: string) => void send: (data: string | ArrayBuffer | Blob) => void } export type WebSocketStatus = 'CONNECTING' | 'OPEN' | 'CLOSING' | 'CLOSED';