onConnect or onInterval hooks of the WebSocket command.
Command Type
Command Type ID: 3Parameters
Message Format
sendMessage is always a string, sent over the socket as-is (a text frame). The feed decides what that string must contain:
- JSON feeds: pass the JSON already stringified (escape the inner quotes), e.g.
"{\"action\":\"subscribe\",\"channel\":\"live_odds\"}". Do not pass a JSON object — it must be a string. - Plain-text feeds: pass the literal token the feed expects, e.g.
"ping". - Placeholders (e.g.
${state.eventId}) are resolved before the message is sent, so you can build the payload from earlier results.
onConnect, onInterval, or onMessage hook); on its own, with no live socket, there is nothing to send.
Usage Examples
Send Subscription Message on Connect
Used inside theonConnect hook of a WebSocket command:
Send Periodic Heartbeat
Used inside anonInterval hook:
Related Commands
- WebSocket - The parent command that provides the connection context
- WebSocket Close - Close the connection after sending