Skip to content

Documents for @litert/websocket / Decl / IServer

Interface: IServer ​

Defined in: src/lib/Decl.ts:57

The interface of websocket server.

Properties ​

frameReceiveMode ​

readonly frameReceiveMode: EFrameReceiveMode

Defined in: src/lib/Decl.ts:84

The mode of receiving frames.

Default ​

ts
EFrameReceiveMode.STANDARD

maxMessageSize ​

maxMessageSize: number

Defined in: src/lib/Decl.ts:77

The maximum size of each message body.

Changing this value will not affect the existing connections.

Default ​

ts
67108864 (64 MiB)

See ​

DEFAULT_MAX_MESSAGE_SIZE


timeout ​

timeout: number

Defined in: src/lib/Decl.ts:67

The timeout in milliseconds for the new connections.

Set to 0 to disable the timeout.

Default ​

ts
60000

Methods ​

accept() ​

accept(opts): IWebSocket

Defined in: src/lib/Decl.ts:89

Accept the websocket request.

Parameters ​

opts ​

IAcceptOptions

Returns ​

IWebSocket


isWebSocketRequest() ​

isWebSocketRequest(req): boolean

Defined in: src/lib/Decl.ts:99

Tell if the request is a websocket request.

Parameters ​

req ​

IncomingMessage

Returns ​

boolean


reject() ​

reject(opts): void

Defined in: src/lib/Decl.ts:94

Reject the websocket request.

Parameters ​

opts ​

IRejectOptions

Returns ​

void