Catch the highlights of GraphQLConf 2023! Click for recordings. Or check out our recap blog post.
Documentation
Modules
use/@fastify/websocket

Module: use/@fastify/websocket

Interfaces

Server/@fastify/websocket

makeHandler

makeHandler<P, E>(options, keepAlive?): fastifyWebsocket.WebsocketHandler

Make a handler to use on a @fastify/websocket (opens in a new tab) route. 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-
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

fastifyWebsocket.WebsocketHandler

Defined in

src/use/@fastify/websocket.ts:35 (opens in a new tab)