/** * The opt-in WebSocket runtime plugin. * * `.use(websocket())` enables `app.ws()`: * * import { websocket } from "@nifrajs/core/ws" * * const app = server().use(websocket()).ws("/chat", { message: (ws, data) => ws.send(data) }) * * Without it, `app.ws()` throws at registration (fail-closed), so an app that never uses WebSockets * never evaluates or bundles the WS dispatcher, pub/sub registry, and Bun socket plumbing (~1.5 KB * gzipped on the minimal-app size benchmark). The runtime installs on that server instance only - * the same `.use()` install seam as `mcp()` / `streaming()` / `idempotency()`, not a process-global * or a side-effect import. * * Serving adapters that wire standard sockets themselves (`@nifrajs/workers`) import * `attachWebSocket` / `TopicRegistry` from here too. */ import type { IdentityPlugin } from "./server/plugin.js"; import { attachWebSocket, TopicRegistry, wrapWebSocketMessageValidation } from "./server/websocket.js"; /** * Enable WebSocket routes on a server: `.use(websocket())` turns on `app.ws()`. Applying it twice is * a no-op (named plugin dedupe). */ export declare function websocket(): IdentityPlugin; export type { NifraWebSocket, StandardWebSocket, WebSocketContext, WebSocketData, WebSocketHandler, WebSocketUpgradeOutcome, } from "./server/websocket.js"; export { attachWebSocket, TopicRegistry, wrapWebSocketMessageValidation }; //# sourceMappingURL=ws.d.ts.map