Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WebSocketBehavior

A structure holding settings and handlers for a WebSocket route handler.

Hierarchy

  • WebSocketBehavior

Index

Properties

Optional close

close: function

Handler for close event, no matter if error, timeout or graceful close. You may not use WebSocket after this event.

Type declaration

    • (ws: WebSocket, code: number, message: ArrayBuffer): void
    • Parameters

      • ws: WebSocket
      • code: number
      • message: ArrayBuffer

      Returns void

Optional compression

compression: CompressOptions

0 = no compression, 1 = shared compressor, 2 = dedicated compressor. See C++ project.

Optional drain

drain: function

Handler for when WebSocket backpressure drains. Check ws.getBufferedAmount().

Type declaration

Optional idleTimeout

idleTimeout: number

Maximum amount of seconds that may pass without sending or getting a message.

Optional maxPayloadLength

maxPayloadLength: number

Maximum length of received message.

Optional message

message: function

Handler for a WebSocket message.

Type declaration

    • (ws: WebSocket, message: ArrayBuffer, isBinary: boolean): void
    • Parameters

      • ws: WebSocket
      • message: ArrayBuffer
      • isBinary: boolean

      Returns void

Optional open

open: function

Handler for new WebSocket connection. WebSocket is valid from open to close, no errors.

Type declaration

Generated using TypeDoc