method WebSocketService.prototype.routeUpgrade
Since 0.3.0
WebSocketService.prototype.routeUpgrade(
request: Request,
principal?: IPrincipal
): Promise<WebSocketUpgradeDecision | null>

The upgrade router the kernel terminal handler consults after the middleware pipeline has run without short-circuiting.

Delegates to the shared #routeReported reporting wrapper: a routing failure is written to the logger here, at its source, before it becomes a refusal. Calling #route directly would make this the one entry point whose failures are invisible — the kernel has no logger to write them to.

Parameters

request: Request

The native, undisturbed upgrade request

optional
principal: IPrincipal

The authenticated principal, when the middleware pipeline produced one (ctx.request.user). Absent when the upgrade was not authenticated; treated as an anonymous connection, never a failure.

Return Type

Promise<WebSocketUpgradeDecision | null>

The decision, or null when this is not a WebSocket route

Usage

import { WebSocketService } from "websocket-plugin/src/index.ts";