/** * Server-Sent Events route — `GET /api/events`. * * Hand-rolled (~40 lines vs. the 30 KB @fastify/sse-v2 dep). The wire format: * * retry: 5000\n\n ← reconnect hint * : heartbeat\n\n ← comment line, every 15 s * event: \n ← event name * data: \n\n ← payload * * The handler subscribes to the bus on connect, unsubscribes on client * disconnect, and ticks a heartbeat so corporate proxies don't close the * connection at the idle timeout. */ import type { FastifyInstance } from 'fastify'; import type { EventBus } from './bus.js'; export interface SseRouteOptions { events: EventBus; /** Test override: shorter heartbeat. */ heartbeatIntervalMs?: number; } export declare function registerSseRoute(app: FastifyInstance, opts: SseRouteOptions): void;