WebsocketRouteOptionsBuilder
Esta página aún no está disponible en tu idioma.
Defined in: src/http/websocket/WebsocketRouteOptions.ts:71
Fluent builder for WebsocketRouteOptionsType.
Extends
Section titled “Extends”OptionsBuilder<WebsocketRouteOptionsType<TOut,TIn>>
Type Parameters
Section titled “Type Parameters”TOut = unknown
TIn = unknown
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WebsocketRouteOptionsBuilder<
TOut,TIn>():WebsocketRouteOptionsBuilder<TOut,TIn>
Returns
Section titled “Returns”WebsocketRouteOptionsBuilder<TOut, TIn>
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”build()
Section titled “build()”build():
Partial<T>
Defined in: src/util/OptionsBuilder.ts:51
Snapshot the set fields as an independent Partial<T> (own props only).
Returns
Section titled “Returns”Partial<T>
Inherited from
Section titled “Inherited from”withAllowedOrigins()
Section titled “withAllowedOrigins()”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.
Parameters
Section titled “Parameters”origins
Section titled “origins”readonly string[]
Returns
Section titled “Returns”this
withCodec()
Section titled “withCodec()”withCodec(
codec):this
Defined in: src/http/websocket/WebsocketRouteOptions.ts:79
Wire codec. Default: jsonCodec<TOut, TIn>().
Parameters
Section titled “Parameters”WebsocketCodec<TOut, TIn>
Returns
Section titled “Returns”this
withMaxBufferedBytes()
Section titled “withMaxBufferedBytes()”withMaxBufferedBytes(
bytes):this
Defined in: src/http/websocket/WebsocketRouteOptions.ts:117
Outbound buffer cap in bytes before backpressure kicks in. Default 4 MiB.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”this
withMaxConnections()
Section titled “withMaxConnections()”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.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”this
withMaxFrameBytes()
Section titled “withMaxFrameBytes()”withMaxFrameBytes(
bytes):this
Defined in: src/http/websocket/WebsocketRouteOptions.ts:102
Inbound frame size cap in bytes. Default 1 MiB.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”this
withOnBackpressure()
Section titled “withOnBackpressure()”withOnBackpressure(
policy):this
Defined in: src/http/websocket/WebsocketRouteOptions.ts:122
What to do when a slow consumer overflows the buffer. Default ‘drop’.
Parameters
Section titled “Parameters”policy
Section titled “policy”Returns
Section titled “Returns”this
withOnInvalidMessage()
Section titled “withOnInvalidMessage()”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’.
Parameters
Section titled “Parameters”policy
Section titled “policy”Returns
Section titled “Returns”this
withOnOversizeFrame()
Section titled “withOnOversizeFrame()”withOnOversizeFrame(
policy):this
Defined in: src/http/websocket/WebsocketRouteOptions.ts:107
What to do with an inbound frame exceeding maxFrameBytes. Default ‘close’.
Parameters
Section titled “Parameters”policy
Section titled “policy”Returns
Section titled “Returns”this
withRequireSameOrigin()
Section titled “withRequireSameOrigin()”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.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”this
create()
Section titled “create()”
staticcreate<TOut,TIn>():WebsocketRouteOptionsBuilder<TOut,TIn>
Defined in: src/http/websocket/WebsocketRouteOptions.ts:74
Start a fresh builder. Equivalent to new WebsocketRouteOptionsBuilder().
Type Parameters
Section titled “Type Parameters”TOut = unknown
TIn = unknown
Returns
Section titled “Returns”WebsocketRouteOptionsBuilder<TOut, TIn>
