Node: UDP Input

From Waltz
Revision as of 15:30, 12 August 2019 by Patrick Angle (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note that this node has slightly different behavior across different platforms due to fundamental differences in how *nix and Windows-based systems handle receiving broadcast messages. See Platform Dependent Networking Quirks for more information.

The UDP Input node allows you to receive UDP messages from devices on your network, and process those messages as appropriate by defining a piece of script that handles incoming messages.

The messageSeparator character is stripped from the message and not included in the message provided for processing in the callback. If the message separator is left empty, messages are separated by packet.

Settings

Expected Type Details Default
localInterface LocalInterface The local network adapter that will be used to UDP messages. LocalInterface("0.0.0.0")
localPort Number The local port on which UDP messages will be received. 1234
ignoreDuplicateMessages Boolean true if you want to ignore messages that are received twice in a row, otherwise false to process each message. false
messageSeparator String A single character to be used to indicate the end of a message, or leave empty to only have messages end on the end of a packet. Only the first codepoint provided is used to separate messages, the rest of this string is ignored. Keep in mind that special characters, like \n \r and \\ are all considered a single character. "\n"
callback Any A script in which a single additional variable, message, is present containing the message to be processed. print(message);

Parameters

There are no parameters exposed by this node. Each received message is processed by the script defined as the callback.

Functions

There are no functions exposed by this node.

Example Usage

Splitting values from messages

In situations where you are receiving multiple values in a single UDP message, for example a situation in which the x, y, and z of a set piece is being sent to Waltz, you may need to split the message into separate values. This can be easily achieved with a small Script Expression in the callback.

Assuming the message is 3,4,5, the following script can separate the message and store them to three different Value Nodes named xValue, yValue, and zValue:

var values = message.split(",");
$.xValue.valueExpression = values[0];
$.yValue.valueExpression = values[1];
$.zValue.valueExpression = values[2];
Nodes
Devices ArtNet Input · ArtNet Output · Interactive LED Processor · NDI™ Input · NDI™ Output · OSC Input · OSC Output · Projector · SensorLink · TCP · TUIO Output · UDP Input · UDP Output · Watchout Media Server
Objects LED Tile Layout · List · Map · Random Number · Simulated Touch · Timer · Value · Wave
Operators Blend · Change · Clip · Cluster Tracker · DMX Multiverse Merge · Ease · Filter · Hold · JSON Mapper · JSON Stringify · Logic · Math · Proximity · Range · Rotate · Scale · Shear · Smooth · Touch Mapper · Translate
Scenes External Scene · Material Scene
Materials Graph · Touch Material
Scripting Script Function · Script
Comments Comment