UDP Endpoint

The UDP Endpoint receives packets sent by the customer's IoT devices, enriches them with identifier data from the Core Network and forwards data to the customer's configured backend application via the Data Broker.
The Endpoint is listening on part 4445 by default. A simple script to send UDP packets to the server will look like this (generic example in NodeJS):

const dgram = require('dgram');
const message = Buffer.from('Hello World');
const client = dgram.createSocket('udp4');
client.send(message, process.env.UDP_PORT_TEST || 4445, '', (err) => {
 if (err) console.err(err);
 return 'done';

All active SIMs from an organisation with a connected AWS Account will be able to successfully publish messages via the UDP Endpoint. The incoming message is enriched by Core Networks IDs and transformed into a JSON message following this format:

 "payload": "incoming_udp_message_string",
 "timestamp": "2020-02-19T12:33:00.000Z",
 "IMSI": "123456789009876",
 "ICCID": "34567895678967",
 "IP_Adress": ""

All messages which are forwarded to the AWS IoT Core are sent to the device-specific topic with the following format:

{thing_name}/messages (where thing_name is the SIMs ICCID).

This will result in a nicely formatted JSON-message that is also human-readable:

Example Implementation for UDP Endpoint

The following example is based on our Blueprint for the PyCom GPy and uses MicroPython:

# -*- coding: utf-8 -*-
import usocket as socket

import config
from lib import logging

logger = logging.get_logger("__main__")

if __name__ == '__main__':
    message = "Hello, UDP. Can you hear me?".encode()

    logger.info("Opening UDP Socket")
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    addr = (config.UDP_ENDPOINT_IP, config.UDP_ENDPOINT_PORT)
        "Sending UDP message to {}:{} with body {}".format(
    s.sendto(message, addr)
    logger.info("Sent UDP Message to the UDP Broker")

UDP is the most lightweight transport protocol and can easily be based on a simple socket connection as shown in the previous example.

Did this page help you?