Defjs
Core

WebSocketDefinition

Contract object passed to defineWebSocket.

@defjs/core · Type

Signature

type WebSocketDefinition<
  TInput extends AnyStruct | undefined = undefined,
  TIncoming extends AnyStruct = AnyStruct,
  TOutgoing extends AnyStruct | undefined = undefined,
> = WebSocketDefinitionBase<TIncoming, TOutgoing> & {
  builder?: OutboundBuilder;
  input?: TInput;
};
  • incoming is the struct every received frame is parsed with. Frames are JSON text.

  • outgoing is the struct session.send validates and encodes with. Without it, send throws.

  • maxIncomingQueueSize is required and must be a positive safe integer. maxOutgoingQueueSize must be a non-negative safe integer; it defaults to 0, which disables queueing of messages sent while the session is reconnecting.

  • protocols is the static default subprotocol list. RequestOptions.protocols and withWebSocketProtocols override it.

  • operation is a static, low-cardinality name for telemetry.

  • input is the struct for the operation input. A declared input always requires an explicit builder. input only defines the parameters; the builder alone decides where each value goes. Only definitions without input may omit builder. The builder may return path and query only; see WebSocketRequestShape.

Invalid queue limits are reported when the operation runs, as a REQ_OPTIONS_INVALID fault.

Members

Prop

Type

incoming TIncoming
maxIncomingQueueSize number
maxOutgoingQueueSize? number | undefined
operation? string | undefined
outgoing? TOutgoing | undefined
path string
protocols? readonly string[] | undefined
builder? OutboundBuilder | undefined
input? TInput | undefined
Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao