Appearance
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
| Pin | Kind | Types | Description |
|---|---|---|---|
| Input | input | Viaducta.Plugins.Http.Types.WebSocketMessage, Viaducta.Plugins.TextPlugin.Types.TextRecord | Message to send. |
| Continue | continue | Called after sending, with the same input record. |
Configuration
None besides the common settings.
Behaviour
TextRecord:Valueis sent as a text message (empty when null).WebSocketMessage:ContentByteis sent if set, otherwiseContentString(UTF-8);MessageType0= text,1= binary. ItsSessionIdmust be the session of the metadata, otherwise an error is raised.- Missing
WebSocketListenermetadata (not in a listener branch) raises an error. - If the client is gone, the connection is closed and nothing is sent;
Continueis still called.
Notes
- When you reuse the received
WebSocketMessageand change onlyContentString, also setContentByteto null, otherwise the original bytes are echoed. - To send to a different client, use the listener's
Inputpin with that client'sSessionId.
Example
Web socket listener → Script (TextRecord with reply text) → Web socket response