property WebSocketPluginOptions.routes
Since 0.3.0

Routes registered declaratively, as an alternative to calling service.route(...) imperatively after start(). Each entry — instance or RegistryFactory — produces one route() call, so a route can be declared where the plugin is composed instead of after the application has started.

Instance entries register during the plugin's register() phase, identical to the imperative timing. Factory entries are resolved in the onInit phase — the first at which the registry holds every capability — so a factory can build its handlers from a resolved capability. A factory that throws rejects start() with an error naming WebSocketPlugin({ routes }) and the entry's index in THIS declared array, not its position among the factories.

Duplicate paths throw exactly as two imperative route() calls with the same path would.

Type

Usage

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