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

ParameterTypeDefault
modeString"server"
urlString""
json_pathString""
enabledBooleantrue

Gotchas

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

  1. 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.

  2. Send a JSON message like {"data": {"temperature": 21.5}} over the connection.

  3. Set JSON Path to data.temperature to pull that value straight into the Number output.

  4. 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