WebSocket Trigger Node
The WebSocket Trigger fires a workflow whenever the selected WebSocket integration receives a message or connection event.
Node Properties
The WebSocket Trigger requires choosing a WebSocket integration, as well as at least one of the following events on which to fire the trigger:
- Trigger on a connection
- Trigger on a message (checked by default)
- Trigger on a disconnection
- Trigger on a failure to connect
Payload
The payload will include the received message in the data
field. In the general case, a WebSocket Trigger workflow payload will look like the following:
{
"applicationId": "555555555555eeeeeeeeeeee",
"applicationName": "My Great Application",
"data": {
"headers": {
"connection": "upgrade",
"upgrade": "websocket"
},
"message": {
"data": "an example message",
"length": 18,
"reason": "Unexpected server response: 200",
"statusCode": 1006
},
"type": "connect|message|disconnect|failure"
},
"flowId": "333333333333cccccccccccc",
"flowName": "My Great Workflow",
"flowVersion": "myFlowVersion",
"globals": {
"aJsonGlobal": {
"key": "value"
},
"aNumberGlobal": 42,
"aStringGlobal": "My value"
},
"relayId": "<ID of the integration>",
"relayType": "integration",
"time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
"triggerId": "<ID of the integration>",
"triggerType": "integration"
}
Note: The value in the data.message.data
field will always be a string. If you are expecting structured data (objects or arrays) through a WebSocket integration, you must follow up the trigger with a JSON: Decode Node to convert the value at data.message.data
to a structured format, and your workflow should be resilient to cases where the decoding of the data fails.
Differences from Webhook Trigger
The WebSocket Trigger should not be confused with the Webhook Trigger. The WebSocket Trigger only fires for messages received through a WebSocket integration, whereas the Webhook Trigger fires for messages received from clients connecting to a WebSocket-type Webhook.
Related Nodes
Was this page helpful?
Still looking for help? You can also search the WEGnology Forums or submit your question there.