Zebflow Docs
trigger.socket
Zebflow Docs

trigger.socket

Runs the pipeline for every message from an outbound WebSocket

trigger.socket --url TEXT [--credential TEXT] [--delay DURATION] [--max-attempts N] [--heartbeat DURATION] [--parse json|text] → socket

Runs the pipeline for every message from an outbound WebSocket. It keeps an outbound WebSocket connection to another server open while the pipeline is active and runs the pipeline for every message it receives — price feeds, a broker, another Zebflow. --url is ws:// or wss://; --credential supplies auth if the server needs it. A socket reconnects with backoff starting at --delay (default 5s); --max-attempts bounds it (omitted = unlimited, 0 = never reconnect, N = at most N reconnects). Answers one key, socket: { url, message, node_id } — the message is input.socket.message ($trigger.message), parsed JSON with --parse json (default), a string with text. To send back on the same connection use ws.message.send --connection <this node id>. Not for browsers: that is trigger.room.

Flags

  • --url (required): WebSocket server URL (ws:// or wss://).
  • --credential: Credential id for auth headers/tokens.
  • --delay: First reconnect delay (5s, 500ms); backoff doubles it up to 60s. Default: 5s.
  • --max-attempts: Reconnects allowed: omitted = unlimited, 0 = never reconnect, N = at most N.
  • --heartbeat: Ping interval (30s). Default: 30s.
  • --parse: How a received message is read: json (default) or text.

Examples

Follow a price feed

| trigger.socket --url wss://feed.example.com/ticks --parse json --delay 2s --max-attempts 10

It answers:

json
{  "socket": {    "url": "wss://feed.example.com/ticks",    "message": {      "symbol": "AUDUSD",      "bid": 0.6512    },    "node_id": "n0"  }}