[]previous and next page

WebSocketLimits

Limits of a connection.

Limits of a connection.

Import#

ts
import type { WebSocketLimits } from "@shadow-js/dusk/server";

Signature#

ts
interface WebSocketLimits {
  /** Largest message a client may send, in bytes. Larger closes with 1009. */
  readonly maxMessageBytes: number;
  /** Messages a client may send in one second. More closes with 1008. */
  readonly maxMessagesPerSecond: number;
  /** Milliseconds between the server's pings. */
  readonly pingIntervalMs: number;
  /** Milliseconds a ping may wait for its pong before the connection is dropped. */
  readonly pongTimeoutMs: number;
  /**
   * Message handler calls that may be in flight at once (a call that returned a promise not yet settled).
   * The next message closes the connection with 1013 and is not handled. Default 16.
   */
  readonly maxInFlightMessages?: number;
  /**
   * Unsent bytes a transport may hold for a connection before it is dropped (see {@link WebSocketSink.buffered}).
   * Default 8 times `maxMessageBytes`.
   */
  readonly maxBufferedBytes?: number;
}

Members#

Name Type Description
maxMessageBytes readonly maxMessageBytes: number Largest message a client may send, in bytes. Larger closes with 1009.
maxMessagesPerSecond readonly maxMessagesPerSecond: number Messages a client may send in one second. More closes with 1008.
pingIntervalMs readonly pingIntervalMs: number Milliseconds between the server's pings.
pongTimeoutMs readonly pongTimeoutMs: number Milliseconds a ping may wait for its pong before the connection is dropped.
maxInFlightMessages? readonly maxInFlightMessages?: number Message handler calls that may be in flight at once (a call that returned a promise not yet settled). The next message closes the connection with 1013 and is not handled. Default 16.
maxBufferedBytes? readonly maxBufferedBytes?: number Unsent bytes a transport may hold for a connection before it is dropped (see WebSocketSink.buffered). Default 8 times maxMessageBytes.