The UDP Service lets you send and receive arbitrary UDP messages via triggers. This service enables you to communicate with custom devices that do not speak industry standard protocols.
The UDP service contains the information required to begin sending and receiving UDP messages. The UDP service is able to receive data in many formats, if the payload is JSON, it will automatically be parsed into an object before the event is generated.
The UDP service also supports the concept of "queueing" messages for devices. This is useful when you have devices that spend most of their time asleep. When the device sends a packet to the server, the server will check for any queued messages and will send any messages that have been queued to the device immediately after receiving the message.
You must open a support ticket and request a port be assigned to you for your project. Until a port is assigned, you will not recieve any packets on your service defintion.
ascii_delimited
will parse a delimited string into an array of tokens and extract a value at a particular token offset.ascii_fixed
will extract a key from a fixed byte offset and length in the packet.binary_fixed
will extract a key from a fixed byte offset and can format the value in various ways.json
will parse the packet as JSON and extract the field from the specified path.custom
special parsers for particular device manufacturers that cannot be easily extracted with other means.{"delim":",", "index":2}
update,20230102121009,35011230124101
will extract 35011230124101
.{"index": 0, "length":15}
35011230124101UPD23.2
will extract 35011230124101
.
{"index": 0, "length":8, "format":"hex"}
0011035011230124101
will extract 035011230124101
.hex
to hex encode the bytes as a string.{"key":"035011230124101","temp":25.2}
will extract 035011230124101
.{"format":"queclink"}
queclink
.This event fires when a packet is received on the UDP port.
{
"payload": "+RESP:GTINF,423134,352009111849894,,42,89883070000011234000,20,5,0,,FF,,,4.19,0,5,2,0,0,20230307221729,100,,,,,20230307221730,0007$",
"remoteAddr": "44.204.32.28:800"
}
Send a packet via UDP.
// Send an ASCII packet to the specified address.
udp.send('myservice', '44.204.32.28:800', '+ACK:0007$')
// Send a binary packet to the specified address.
udp.send('myservice', '44.204.32.28:800', [ 0x01, 0x02, 0x03])
// Send a JSON packet to the specified address.
udp.send('myservice', '44.204.32.28:800', { key1: 'value1', key2: 123})
// Send a packet to an endpoint by key instead of address.
udp.send('myservice', 'myendpoint', '+ACK:0007$')
Queue a packet to be sent immediately after the next UDP packet is received. This is useful for devices that are mostly asleep and cannot receive except for a short window after they transmit data.
// Queue a packet with a 600 second TTL
udp.queue('myservice', 'myendpoint', 'set-temp', '+SETTEMP:25.2$', 600)
udp.queue()
for the same service+endpoint+queue key tuple will overwrite the previous value. If you wish to simply queue multiple requests without de-duplication send queue key of ''
(blank).The following events are considered billable: