import type { Server as HttpServer } from 'http'; import type { LTEvent, LTEventAdapter } from '../../types'; /** * Callback to verify a Socket.IO handshake token. * Return `true` to allow the connection, `false` to reject. */ export type SocketIOAuthenticator = (token: string) => boolean | Promise; /** * Socket.IO event adapter for browser clients. * * Publishes LTEvent payloads to all connected Socket.IO clients * on channels following the pattern: `lt.events.{event.type}` * * The HTTP server must be attached via `attachServer()` before * `connect()` is called. The startup flow handles this automatically * when Socket.IO is the active event transport. * * When an `authenticate` callback is provided, Socket.IO middleware * rejects handshakes that do not include a valid `auth.token`. * * Usage: * ```typescript * import { eventRegistry } from '@hotmeshio/long-tail'; * import { SocketIOEventAdapter } from '@hotmeshio/long-tail'; * * const adapter = new SocketIOEventAdapter(); * eventRegistry.register(adapter); * // After HTTP server is created: * adapter.attachServer(httpServer); * await eventRegistry.connect(); * ``` */ export declare class SocketIOEventAdapter implements LTEventAdapter { private io; private httpServer; private authenticate; private socketPath; constructor(options?: { authenticate?: SocketIOAuthenticator; }); /** Attach to an HTTP server. Must be called before connect(). */ attachServer(server: HttpServer): void; /** Override the socket.io path (for subpath-mounted deployments). */ setPath(socketPath: string): void; connect(): Promise; publish(event: LTEvent): Promise; disconnect(): Promise; }