type RealtimeEventHandler = { handle(event: Event): void; }["handle"]; export interface RealtimeSocket { onclose: RealtimeEventHandler<{ type: string; }> | null; onerror: RealtimeEventHandler<{ type: string; }> | null; onmessage: RealtimeEventHandler<{ data: unknown; }> | null; onopen: RealtimeEventHandler<{ type: string; }> | null; close: () => void; send: (data: string) => void; } export type RealtimeSocketConstructor = new (url: string) => RealtimeSocket; export interface RealtimeConnectionController { start: () => void; stop: () => void; } export interface RealtimeConnectionAttempt { registrationMessage: string; url: string; } export interface RealtimeConnectionOptions { clearTimeout?: typeof clearTimeout; /** * Observes an asynchronous transport failure after `start()` returns, * including automatic reconnect setup and registration send failures. * Recovery remains owned by the connection controller. */ onAsyncTransportError?: (error: unknown) => void; /** * Reports an automatic reconnect setup failure that stops reconnection. * Synchronous failures during direct `start()` still throw to the caller. */ onReconnectSetupError?: (error: unknown) => void; /** * Called after a registration frame is sent successfully and the transport * has established its connected state and next refresh schedule. */ onRegistrationSent?: (registrationMessage: string) => void; onMessage: (data: unknown) => void; onSocketError?: (event: { type: string; }) => void; reconnectDelayMs?: number; registrationRefreshMs?: number | null; resolveConnectionAttempt: () => RealtimeConnectionAttempt | null; setTimeout?: typeof setTimeout; shouldAttemptConnection?: () => boolean; socketConstructor: RealtimeSocketConstructor; } export declare const createRealtimeConnectionController: ({ clearTimeout: clearTimeoutRef, onMessage, onAsyncTransportError, onReconnectSetupError, onRegistrationSent, onSocketError, reconnectDelayMs, registrationRefreshMs, resolveConnectionAttempt, setTimeout: setTimeoutRef, shouldAttemptConnection, socketConstructor, }: RealtimeConnectionOptions) => RealtimeConnectionController; export {}; //# sourceMappingURL=realtime-connection.d.ts.map