/** * WebSocket delegation channel handler. * * Manages WS upgrade requests, message parsing, and delegation event * forwarding for the `/ws/delegation` channel. * * @module sidecar/server/ws/delegation */ import type { IncomingMessage } from "node:http"; import type { Duplex } from "node:stream"; import type { SidecarDependencyRegistry } from "../registry.js"; import type { WsConnectionPool } from "./pool.js"; /** Valid WS message types. */ export declare const WsMessageType: readonly ["subscribe", "unsubscribe", "ping", "event"]; export type WsMessageType = (typeof WsMessageType)[number]; /** Dependencies for creating a WS delegation handler. */ export interface WsDelegationHandlerDeps { registry: SidecarDependencyRegistry; pool: WsConnectionPool; } /** * Create a WS delegation handler bound to the given dependencies. * * Returns a callable upgrade handler function with an `onMessage` * property for test assertions (duck-typed per WS test expectations). * * @param deps - Dependencies including registry and WS pool. * @returns A callable handler function with onMessage property. */ export declare function createWsDelegationHandler(deps: WsDelegationHandlerDeps): ((req: IncomingMessage, socket: Duplex, head: Buffer) => Promise) & { onMessage: (msg: unknown) => { code?: number; } | void; }; //# sourceMappingURL=delegation.d.ts.map