method DenoHttpAdapter.prototype.setUpgradeRouter
Since 0.2.0
DenoHttpAdapter.prototype.setUpgradeRouter(router: WebSocketUpgradeRouter): void

Installs a WebSocket upgrade router. The adapter stores the router but does not consult it: since M70a the kernel's terminal handler resolves IWebSocketService and calls routeUpgrade itself, after the middleware pipeline has run without short-circuiting and before route matching — so an application catch-all cannot shadow an upgrade. What the adapter needs from this setter is the bare fact that a router was installed: Node attaches its raw upgrade listener only then.

Optional: absent on adapters that cannot perform a WebSocket handshake. Callers MUST degrade gracefully when it is not provided — see the WebSocketPlugin, which still registers its service and health indicator but fails route() with a typed error. Because the member is optional, adapters written before this seam existed remain valid implementations.

Upgrade detection is the router's own job — it returns null for anything that is not an upgrade on a path it owns, and the kernel falls through to normal HTTP handling — so installing a router never changes the behavior of non-WebSocket traffic.

Parameters

router: WebSocketUpgradeRouter

Decides accept, reject, or fall-through per upgrade request

Return Type

void

Usage

import { DenoHttpAdapter } from "runtime/src/index.ts";