Skip to content

WebSocketArc

class WebSocketArc extends WebSocketBase

The WebSocket arc: the WebSocketBase authoring surface plus compilation and per-upgrade execution. host.build() runs COMPILE_WS_ARC; the host runtime drives UPGRADE_WS, which matches the route, runs any pre-handshake upgrade hook, and returns the WsUpgradeOutcome. Matching, input parsing, the hook, and connection construction collapse behind that one entry (the HTTP arc’s fetch analog), so a bad declared param or a hook denial rejects the upgrade before the handshake completes on every backing.

The Symbol-keyed members are the host-arc seam idiom shared with the HTTP arc: they keep internals off the public authoring surface while staying importable by tests and the host runtime.

Handed to you by the framework; see WebSockets.

2 overloads

controller<T extends WebSocketDescriptor>(path: string, cls: WebSocketControllerClass<T>): WebSocketControllerHandle<T>

Registers a controller class at path (one instance per connection), returning a WebSocketControllerHandle for the upgrade hook.

path string

cls WebSocketControllerClass<T>

returns WebSocketControllerHandle<T>

controller<O extends WebSocketControllerRouteOptions>(path: string, opts: O, cls: WebSocketControllerClass<DescriptorOf<O>>): WebSocketControllerHandle<DescriptorOf<O>>

Registers a controller class at path (one instance per connection), returning a WebSocketControllerHandle for the upgrade hook.

path string

opts O

cls WebSocketControllerClass<DescriptorOf<O>>

returns WebSocketControllerHandle<DescriptorOf<O>>

2 overloads

route(path: string): WebSocketRouteHandle<{}, {}>

Registers a connection route at path, returning a WebSocketRouteHandle to attach behaviors to.

path string

returns WebSocketRouteHandle<{}, {}>

route<O extends WebSocketRouteOptions>(path: string, opts: O): WebSocketRouteHandle<InjectOf<O>, DescriptorOf<O>>

Registers a connection route at path, returning a WebSocketRouteHandle to attach behaviors to.

path string

opts O

returns WebSocketRouteHandle<InjectOf<O>, DescriptorOf<O>>

Learn: WebSockets

Last updated: