ReadonlycloseStops the adapter: removes its listeners from the HTTP server and closes the WebSocket server.
contracts/common.md#principled-implementation The listeners are removed before the ws server closes, so no upgrade event reaches a closing server, and the returned promise resolves when the server has closed.
contracts/common.md#clear-and-simple-design An arrow property so the same function value can be registered and unregistered as the HTTP server's close listener.
StaticupgradeCreates the adapter for the application: it visits every controller, validates the WebSocket routes, and starts listening for upgrade events.
All route errors of the application are collected and thrown together, with the controller, method, source location, and reasons of each.
contracts/common.md#principled-implementation Controller data-method descriptors are checked before any handshake is served, with child properties shadowing inherited methods and accessors never executed, and all defects are reported in one error, so a misconfigured route fails at start and not at the first client; source locations come from get-function-location, converted with fileURLToPath so a file: URL becomes the path on every platform.
contracts/common.md#clear-and-simple-design One asynchronous factory that awaits the visitor and hands the operator list to the private constructor.
contracts/common.md#prohibited-implementation-shortcuts The visitor reports through the same error path for every controller; no controller or route name is special-cased.
Serves the
@WebSocketRoute()methods of a NestJS application over WebSocket.Call upgrade after the application has been created. It finds the routes, checks them, and takes over the HTTP server's
upgradeevents. A handshake whose path matches no route is rejected with close code 1002.Evidence
contracts/common.md#principled-implementation Routes are matched by paths built from the global prefix, the version, the module prefix, the controller path, and the method path, joined and normalized the same way for every combination; the adapter answers upgrade events itself through a
wsserver in no-server mode and removes its listeners when the HTTP server closes.Evidence
contracts/common.md#clear-and-simple-design A class with one static factory, one
closeproperty, and the private handler; discovery, method checks, termination, and close reasons are module-private functions.Evidence
contracts/common.md#prohibited-implementation-shortcuts The global prefix, versioning options, and module graph are read from
app.configandapp.container, which NestJS keeps internal becauseINestApplicationhas no public accessor for them; this is the limitation of the adapter, not a fixture-specific branch.Evidence
contracts/common.md#meaningful-documentation The comment states when to call it and what happens to an unmatched handshake.
Evidence
contracts/portability.md#os-neutral-implementation Diagnostic source URLs are converted by fileURLToPath before path.relative uses native paths; route matching uses HTTP path segments separately from filesystem paths. No filesystem case policy is inferred from the OS.