Using UDP with Memfault
Memfault servers do not accept UDP transfers natively, and the ideal method to send Memfault data is to Memfault's HTTPS API endpoint. If UDP is desired due to device constraints or already having an existing connection to the cloud, it is still easy to get data into the Memfault platform.
To transfer data from a device that can send UDP datagrams (such as the nRF9160), an additional server must act as a relay between the device and Memfault servers.
If your device is using CoAP over UDP, check out the documentation at CoAP with Memfault.
Example Forwarding Server
A
working sample of a complete setup can be found here.
It features a Python UDP server that relays data to Memfault, and a firmware
implementation with a UDP client. The device and the Python server use a simple
binary encoding format that includes the following sections, separated by a
NULL
byte:
- A version section identifying the encoding format for forward compatibility.
- A Project Key.
- The device serial.
- The Memfault chunk.
This configuration allows for a simple, stateless UDP server that passes data over to Memfault.