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; };
-
incomingis the struct every received frame is parsed with. Frames are JSON text. -
outgoingis the structsession.sendvalidates and encodes with. Without it,sendthrows. -
maxIncomingQueueSizeis required and must be a positive safe integer.maxOutgoingQueueSizemust be a non-negative safe integer; it defaults to0, which disables queueing of messages sent while the session isreconnecting. -
protocolsis the static default subprotocol list.RequestOptions.protocolsand withWebSocketProtocols override it. -
operationis a static, low-cardinality name for telemetry. -
inputis the struct for the operation input. A declaredinputalways requires an explicitbuilder.inputonly defines the parameters; the builder alone decides where each value goes. Only definitions withoutinputmay omitbuilder. The builder may returnpathandqueryonly; see WebSocketRequestShape.
Invalid queue limits are reported when the operation runs, as a REQ_OPTIONS_INVALID fault.
Members
Prop
Type
incoming TIncomingmaxIncomingQueueSize numbermaxOutgoingQueueSize? number | undefinedoperation? string | undefinedoutgoing? TOutgoing | undefinedpath stringprotocols? readonly string[] | undefinedbuilder? OutboundBuilder | undefinedinput? TInput | undefined