Overview
This node implements a UDP server trigger that listens for incoming UDP datagrams on a specified host and port. When data is received, it triggers the workflow with details about the message and sender. It can optionally send a response back to the client.
Common scenarios include:
- Receiving sensor or IoT device data sent via UDP.
- Listening for log messages or alerts broadcast over UDP.
- Integrating with systems that communicate using UDP packets.
Practical example:
- A network monitoring system sends status updates as UDP packets; this node captures those packets and triggers workflows to process or store the data.
Properties
Name | Meaning |
---|---|
Port | The UDP port number to listen on (1–65535). |
Host | The IP address or hostname to bind the UDP server to. Use 127.0.0.1 for localhost or 0.0.0.0 for all interfaces. |
Options | Collection of additional options: |
- Encoding | Text encoding used to decode incoming UDP data. Options: UTF-8, ASCII, Base64, Hex. |
- Send Response | Whether to send a response message back to the UDP client after receiving data (true/false). |
- Response Message | The message text to send back if "Send Response" is enabled. |
- Buffer Size | Maximum buffer size in bytes for incoming messages (64–65536). |
Output
The node outputs JSON data with the following structure:
protocol
: Always"udp"
.server
: Object containinghost
andport
where the server is listening.client
: Object with details about the sender:address
: IP address of the client.port
: Client's source port.family
: IP family (e.g., IPv4).size
: Size of the received message in bytes.
data
: The received message decoded as a string using the selected encoding.encoding
: The text encoding used.bytes
: Number of bytes received.timestamp
: ISO timestamp when the message was received.responseSent
: Boolean indicating if a response was sent back to the client.
If binary data is present, it is included under the binary
field as base64 encoded data with MIME type application/octet-stream
.
Dependencies
- Uses Node.js built-in
dgram
module to create the UDP socket. - Requires no external API keys or services.
- No special environment variables needed.
Troubleshooting
- Port already in use error: If the configured port is occupied by another process, the node will throw an error indicating the port conflict. To resolve, choose a different port number.
- UDP Server Error: Other socket errors will be reported with their message. Check network permissions and firewall settings.
- No data received: Ensure the UDP client is sending data to the correct host and port matching the node configuration.
- Response not received by client: Verify that "Send Response" is enabled and the response message is set correctly.