import { createNodeWebSocket } from "@hono/node-ws"; import type { Hono as HonoApp } from "hono"; import type { UpgradeWebSocket } from "hono/ws"; import type { Server } from "http"; import type { WebSocket } from "ws"; import type { AppEnv } from "../app"; import type { ApiDeps } from "../types/api-deps"; export declare const createWsRoutes: (deps: ApiDeps, upgradeWebSocket: UpgradeWebSocket) => HonoApp; /** * Ceiling on ONE client→server frame, enforced BEFORE the frame is allocated * (NONCE-DESIGN §10). * * Everything a client sends is a control message — `register`, * `subscribe_session`, `unsubscribe_session`, `hold_session` — none of which * reaches a kilobyte, so this is generous by three orders of magnitude and * still small enough that a socket without keys cannot make the process buffer * anything worth buffering. * * The server→client direction is bounded by the CLIENT, which is the only side * that can refuse a frame before allocating it; `terminal_replay` is the large * one and it is capped upstream by `REPLAY_MAX_LINES`. */ export declare const WS_MAX_CLIENT_FRAME_BYTES: number; /** * Mount `/ws` on an app that is already built, and bind the frame ceiling. * * **This exists so the bound is wired in exactly one place.** §10 states the * gap plainly: `@hono/node-ws` constructs its `WebSocketServer` with * `{ noServer: true }` and nothing else, so `ws`'s 100 MiB `maxPayload` default * applies and a frame is fully assembled before any record-layer check runs — * anyone holding a socket without keys, a ticket thief or a legacy `?key=` * client, could push 100 MiB. §10 offers two ways out: build our own server * with a bound, or accept the ceiling and reap silent sockets. * * This is the first, without forking the upgrade path. `@hono/node-ws` RETURNS * the server it made, and `ws` reads `this.options.maxPayload` per upgrade in * `completeUpgrade` rather than at construction — so lowering it here bounds * every socket from the next one onwards. That is the whole "construct your own * server" outcome in one assignment, with no copy of the upgrade handling to * keep in sync. It is receiver-only: `maxPayload` bounds what `ws` will ACCEPT * and never what it will send, which is exactly the per-direction split §10 * asks for. * * The cost is reaching into a dependency's `options`. That is why this is one * function called by both `server.ts` and the sealing tests rather than two * copies: a test that stood the wiring up itself would be asserting on its own * copy of it. */ export declare function mountWebSocket(app: HonoApp, httpServer: Server, deps: ApiDeps): { wss: ReturnType["wss"]; }; //# sourceMappingURL=ws.routes.d.ts.map