WebSocket Input
Receive data over a WebSocket connection.
What it does
WebSocket Input receives live data over a WebSocket connection and exposes it as several outputs at once: the raw message text, a number, an array of numbers, a connection flag, a client count, and an error string. It either listens on the app's built-in server, so an external tool connects in, or acts as a client connecting out to someone else's WebSocket server.
JSON Path reaches into a JSON message and pulls out one field. Left empty, the whole message passes through untouched.
When to use it
Parameters driven live from an external app, script or hardware bridge that speaks WebSocket
The graph acting as a WebSocket server other tools connect into, in Server mode
Live data pulled from someone else's WebSocket server, in Client mode with its URL
A single numeric field out of a JSON payload, with JSON Path set to that field's key
| Parameter | Type | Default |
|---|---|---|
mode | String | "server" |
url | String | "" |
json_path | String | "" |
enabled | Boolean | true |
Gotchas
URL only matters in Client mode. In Server mode the node listens on the app's built-in server and URL is ignored.
Client Count only means something in Server mode, where it reports how many external clients are currently connected.
The node has to be Enabled to receive anything. Toggling it off stops updates without deleting the connection settings.
If JSON Path does not match anything in the incoming message, the number and array outputs do not update. Check Error and the raw Message output to see what is actually arriving.
Worked example
Add a WebSocket Input. Leave Mode on Server to accept incoming connections, or switch to Client and set URL to the server you want to reach.
Send a JSON message like
{"data": {"temperature": 21.5}}over the connection.Set JSON Path to
data.temperatureto pull that value straight into the Number output.Check Connected and Error to confirm the link is live before wiring the outputs onward.
See also
MQTT Subscribe · OSC Input · WebSocket Output · Numbers, signals & audio