function asUpgradeEmitter
Since 0.2.0
asUpgradeEmitter(server: unknown): UpgradeEmitter | null

Probes a server handle for the raw upgrade event.

serve() returns node-server's ServerType union of node:http and node:http2 servers, whose on overloads are declared with any listeners and so cannot be expressed on NodeServer without a variance conflict. Probing here keeps the published interface clean and confines the narrowing to one boundary.

Parameters

server: unknown

The server handle returned by serve()

Return Type

The emitter, or null when the handle emits no events (e.g. a test fake)

Usage

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