コンテンツにスキップ
日本語

WebsocketRouteOptionsBuilder

このコンテンツはまだ日本語訳がありません。

Defined in: src/http/websocket/WebsocketRouteOptions.ts:71

Fluent builder for WebsocketRouteOptionsType.

TOut = unknown

TIn = unknown

new WebsocketRouteOptionsBuilder<TOut, TIn>(): WebsocketRouteOptionsBuilder<TOut, TIn>

WebsocketRouteOptionsBuilder<TOut, TIn>

OptionsBuilder.constructor

build(): Partial<T>

Defined in: src/util/OptionsBuilder.ts:51

Snapshot the set fields as an independent Partial<T> (own props only).

Partial<T>

OptionsBuilder.build


withAllowedOrigins(origins): this

Defined in: src/http/websocket/WebsocketRouteOptions.ts:88

Restrict the upgrade to these browser origins (CSWSH defence). A present-but-unlisted Origin gets 403; a missing Origin (non-browser client) is allowed. Case-insensitive.

readonly string[]

this


withCodec(codec): this

Defined in: src/http/websocket/WebsocketRouteOptions.ts:79

Wire codec. Default: jsonCodec<TOut, TIn>().

WebsocketCodec<TOut, TIn>

this


withMaxBufferedBytes(bytes): this

Defined in: src/http/websocket/WebsocketRouteOptions.ts:117

Outbound buffer cap in bytes before backpressure kicks in. Default 4 MiB.

number

this


withMaxConnections(max): this

Defined in: src/http/websocket/WebsocketRouteOptions.ts:131

Cap concurrent connections for this route. A new upgrade beyond the cap is closed with 1013 (“try again later”) before it is wired up (security audit WS-5). Default: unlimited.

number

this


withMaxFrameBytes(bytes): this

Defined in: src/http/websocket/WebsocketRouteOptions.ts:102

Inbound frame size cap in bytes. Default 1 MiB.

number

this


withOnBackpressure(policy): this

Defined in: src/http/websocket/WebsocketRouteOptions.ts:122

What to do when a slow consumer overflows the buffer. Default ‘drop’.

BackpressurePolicy

this


withOnInvalidMessage(policy): this

Defined in: src/http/websocket/WebsocketRouteOptions.ts:112

What to do with an inbound frame the codec can’t decode. Default ‘close’.

InvalidMessagePolicy

this


withOnOversizeFrame(policy): this

Defined in: src/http/websocket/WebsocketRouteOptions.ts:107

What to do with an inbound frame exceeding maxFrameBytes. Default ‘close’.

OversizeFramePolicy

this


withRequireSameOrigin(enabled): this

Defined in: src/http/websocket/WebsocketRouteOptions.ts:97

Accept an upgrade whose Origin names this same server, so a page the server itself serves works without knowing the host in advance. Combines with withAllowedOrigins; a missing Origin stays allowed.

boolean

this


static create<TOut, TIn>(): WebsocketRouteOptionsBuilder<TOut, TIn>

Defined in: src/http/websocket/WebsocketRouteOptions.ts:74

Start a fresh builder. Equivalent to new WebsocketRouteOptionsBuilder().

TOut = unknown

TIn = unknown

WebsocketRouteOptionsBuilder<TOut, TIn>