Module: use/ws
Interfaces
Server/ws
useServer
▸ useServer<P
, E
>(options
, ws
, keepAlive?
): Disposable
Use the server on a ws ws server. This is a basic starter, feel free to copy the code over and adjust it to your needs
Type parameters
Name | Type |
---|---|
P | extends undefined | Record <string , unknown > = undefined | Record <string , unknown > |
E | extends Record <PropertyKey , unknown > = Record <PropertyKey , never > |
Parameters
Name | Type | Default value | Description |
---|---|---|---|
options | ServerOptions <P , Extra & Partial <E >> | undefined | - |
ws | WebSocketServer | undefined | - |
keepAlive | number | 12_000 | The timeout between dispatched keep-alive messages. Internally uses the ws Ping and Pongs 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 |