Interface IServerConfig

Hierarchy

Index

Properties

Properties

optional public assembleFragments?: boolean

If true, fragmented messages will be automatically assembled and the full message will be emitted via a message event. If false, each frame will be emitted on the connection object via a frame event and the application will be responsible for aggregating multiple fragmented frames. Single-frame messages will emit a message event in addition to the frame event.

default

true

optional public autoAcceptConnections?: boolean

If this is true, websocket connections will be accepted regardless of the path and protocol specified by the client. The protocol accepted will be the first that was requested by the client.

default

false

optional public closeTimeout?: number

The number of milliseconds to wait after sending a close frame for an acknowledgement to come back before giving up and just closing the socket.

default

5000

optional public disableNagleAlgorithm?: boolean

The Nagle Algorithm makes more efficient use of network resources by introducing a small delay before sending small packets so that multiple messages can be batched together before going onto the wire. This however comes at the cost of latency.

default

true

optional public dropConnectionOnKeepaliveTimeout?: boolean

If true, the server will consider any connection that has not received any data within the amount of time specified by keepaliveGracePeriod after a keepalive ping has been sent. Ignored if keepalive is false.

default

true

optional public fragmentOutgoingMessages?: boolean

Whether or not to fragment outgoing messages. If true, messages will be automatically fragmented into chunks of up to fragmentationThreshold bytes.

default

true

optional public fragmentationThreshold?: number

The maximum size of a frame in bytes before it is automatically fragmented.

default

16KiB

public httpServer: Server

The http server instance to attach to

optional public keepalive?: boolean

If true, the server will automatically send a ping to all clients every keepaliveInterval milliseconds. Each client has an independent keepalive timer, which is reset when any data is received from that client.

default

true

optional public keepaliveGracePeriod?: number

The amount of time to wait after sending a keepalive ping before closing the connection if the connected peer does not respond. Ignored if keepalive or dropConnectionOnKeepaliveTimeout are false. The grace period timer is reset when any data is received from the client.

default

10000

optional public keepaliveInterval?: number

The interval in milliseconds to send keepalive pings to connected clients.

default

20000

optional public maxReceivedFrameSize?: number

The maximum allowed received frame size in bytes. Single frame messages will also be limited to this maximum.

default

64KiB

optional public maxReceivedMessageSize?: number

The maximum allowed aggregate message size (for fragmented messages) in bytes.

default

1MiB