Skip to content
tRPC

Partners

Type Alias: WSSHandlerOptions<TRouter>

On this page

WSSHandlerOptions<TRouter>: WSConnectionHandlerOptions<TRouter> & object

Defined in: packages/server/src/adapters/ws.ts:131

The options of applyWSSHandler.

Type declaration

dangerouslyDisablePong?

optional dangerouslyDisablePong: boolean

Stops answering clients' pings. Meant for tests.

Default

false

experimental_encoder?

optional experimental_encoder: Encoder

Encodes and decodes messages, for formats other than JSON. Experimental: it may change in any release.

Default

jsonEncoder

keepAlive?

optional keepAlive: object

Sends pings to each client and closes connections that stop answering.

keepAlive.enabled

enabled: boolean

Whether to send pings.

Default
false

keepAlive.pingMs?

optional pingMs: number

How long a connection can be quiet before a ping, in milliseconds.

Default
30_000

keepAlive.pongWaitMs?

optional pongWaitMs: number

How long to wait for a pong before closing the connection, in milliseconds.

Default
5_000

prefix?

optional prefix: string

Only connections whose URL starts with this are served.

wss

wss: WebSocketServer

The ws server to serve the router on.

Type Parameters

Type Parameter
TRouter extends AnyTRPCRouter

See

https://trpc.io/docs/server/websockets#creating-a-websocket-server