Documentation
Modules
use/uWebSockets

Module: use/uWebSockets

Interfaces

Server/uWebSockets

makeBehavior

makeBehavior<P, E>(options, behavior?, keepAlive?): uWS.WebSocketBehavior<unknown>

Make the behaviour for using a uWebSockets.js (opens in a new tab) WebSocket server. This is a basic starter, feel free to copy the code over and adjust it to your needs

Type parameters

NameType
Pextends undefined | Record<string, unknown> = undefined | Record<string, unknown>
Eextends Record<PropertyKey, unknown> = Record<PropertyKey, never>

Parameters

NameTypeDefault valueDescription
optionsServerOptions<P, Extra & Partial<E>>undefined-
behaviorWebSocketBehavior<unknown>{}-
keepAlivenumber12_000The timout between dispatched keep-alive messages. Internally uses the ws Ping and Pongs (opens in a new tab) to check that the link between the clients and the server is operating and to prevent the link from being broken due to idling. Default ts 12_000 // 12 seconds

Returns

uWS.WebSocketBehavior<unknown>

Defined in

src/use/uWebSockets.ts:70 (opens in a new tab)