Skip to content

Web socket response ​

Sends a message back to the client connection that delivered the current message to a Web socket listener. The connection is taken from the WebSocketListener metadata, so place it in the branch that starts at the listener Output pin.

Pins ​

PinKindTypesDescription
InputinputViaducta.Plugins.Http.Types.WebSocketMessage, Viaducta.Plugins.TextPlugin.Types.TextRecordMessage to send.
ContinuecontinueCalled after sending, with the same input record.

Configuration ​

None besides the common settings.

Behaviour ​

  • TextRecord: Value is sent as a text message (empty when null).
  • WebSocketMessage: ContentByte is sent if set, otherwise ContentString (UTF-8); MessageType 0 = text, 1 = binary. Its SessionId must be the session of the metadata, otherwise an error is raised.
  • Missing WebSocketListener metadata (not in a listener branch) raises an error.
  • If the client is gone, the connection is closed and nothing is sent; Continue is still called.

Notes ​

  • When you reuse the received WebSocketMessage and change only ContentString, also set ContentByte to null, otherwise the original bytes are echoed.
  • To send to a different client, use the listener's Input pin with that client's SessionId.

Example ​

Web socket listener → Script (TextRecord with reply text) → Web socket response

Viaducta documentation