MQTT over UDP — Lightweight IoT Messaging Protocol

MQTT over UDP is a lightweight, low-latency messaging protocol designed to deliver MQTT-style publish/subscribe communication over UDP instead of TCP. It combines MQTT semantics (topics, payloads) with UDP speed (low overhead) and a custom reliability layer (ACK, retry, fragmentation), purpose-built for IoT devices, edge systems, industrial automation, and high-throughput real-time environments.

Low Latency

Removes TCP connection overhead, enabling ultra-fast message delivery for time-critical IoT telemetry and industrial automation.

Custom Reliability

Application-level ACK, retry, and fragmentation/reassembly ensure delivery guarantees without TCP's overhead on constrained networks.

Constrained Devices

Compact binary packets with minimal memory and CPU usage make it ideal for embedded systems, microcontrollers, and low-power IoT nodes.

Use Cases:
  • IoT telemetry — sensors and medical devices
  • Real-time monitoring systems
  • Edge computing and industrial automation
  • High-frequency, low-latency messaging
  • Constrained devices with low memory/CPU

System Architecture

The protocol follows a clean client–transport–broker–subscriber model. Clients construct MQTT-style payloads, fragment them into UDP segments, and transmit with an application-level reliability layer. The server validates, buffers, and reassembles segments before dispatching to subscribers.

Client Components
  • Payload Builder
  • Fragmentation Engine
  • Reliable UDP Sender
  • ACK / Retry Handler (QoS 0/1/2)
  • HMAC-SHA256 Authentication
Server (Broker) Components
  • UDP Listener (Port 1774 default)
  • Packet Validator + CRC Check
  • Reassembly Engine
  • Message Dispatcher
  • Signature & Auth Verification
Subscriber Layer
  • Sensor / Edge Applications
  • Real-time Dashboards
  • Cloud MQTT Bridge
  • Alert & Notification Systems
  • Data Logging Pipelines
MQTT over UDP Architecture Diagram

Fig 1 — MQTT over UDP System Architecture (Protocol v1.1, Author: Ajith Kumar, May 2026)

Packet Format Specification

Each UDP packet consists of a fixed 30-byte binary header followed by variable-length RawData carrying the MQTT topic and payload.

Header Fields:
DeviceID · 8B · uint64 · EUI-64 Signature · 8B · uint64 · HMAC-SHA256 MsgType · 2B · uint16 Timestamp · 4B · uint32 · Unix epoch SegmentNum · 2B · uint16 TotalSegments · 2B · uint16 DataLength · 2B · uint16 CRC · 2B · CRC16-CCITT RawData · Variable · Topic+Payload
RawData (Payload) Format:
[ TopicLen: 2 bytes ] → [ Topic: UTF-8 string ] → [ PayloadLen: 2 bytes ] → [ PayloadData: UTF-8/Binary ]
Packet Sizes
Min: 32 bytes (header only)
Max: 65,567 bytes
MTU target: 1472 bytes
QoS Levels
QoS 0 — No ACK (Fire & Forget) QoS 1 — ACK per Segment QoS 2 — ACK_COMPLETE (Full Message)
Message Types:
CodeTypeDirection
0x0001MSG_PUBLISHClient→Server
0x0002MSG_SUBSCRIBEClient→Server
0x0003MSG_UNSUBSCRIBEClient→Server
0x0004MSG_PINGREQClient→Server
0x0005MSG_CONNECTClient→Server
0x0006MSG_DISCONNECTClient→Server
CodeTypeMeaning
0x1001ACK_SUCCESSSegment OK
0x1002ACK_COMPLETEFull msg received
0x2001NAK_AUTH_FAILAuth failure
0x2002NAK_INVALID_SEGBad segment #
0x2003NAK_CHECKSUMCRC mismatch
0x2004/5NAK_MALFORMED/SIGInvalid packet
Packet Format Specification

Fig 2 — Binary Packet Format with Header Fields, Message Types, and QoS Model

Reliability Model & Security

Reliability Mechanisms
  • Timeout-based retransmission with retry limits
  • Sliding window (4–7 segments recommended)
  • Deduplication via DeviceID + Timestamp + SegmentNum
  • Segment-index based reassembly
  • CRC16-CCITT fast data integrity check
Security Architecture
  • DTLS encryption (recommended for production)
  • Optional AES payload encryption
  • HMAC-SHA256 packet signature
  • Token-based device authentication
  • Timestamp-based replay attack mitigation

Protocol Comparison

XEUPD (eXtended Enhanced UDP Protocol) is our production-hardened implementation that addresses all UDP limitations while maintaining the speed advantage over TCP-based MQTT.

Feature MQTT / TCP MQTT / UDP XEUPD (Our Protocol)
TransportTCPUDPUDP + Reliability Layer
ConnectionStateful (3-way HS)ConnectionlessSession-aware over UDP
Reliability✓ Built-in✗ None✓ Custom ACK + Retry
LatencyModerateVery LowUltra-Low
Protocol OverheadHighMinimalLow (optimized)
FragmentationTCP/IP StackApp ResponsibilityIntelligent Frag Engine
Packet LossAuto retransmitDroppedSelective retransmission
ScalabilityMediumVery HighExtremely High
Broadcast/MulticastLimitedSupportedNative Optimized
IoT SuitabilityGoodVery GoodExcellent
SecurityTLSDTLS / CustomXEUPD Secure Layer
Real-Time SupportLimitedStrongEnterprise-grade
Best Use CasesStandard MessagingGaming, VoIPIoT, Medical, Telemetry
Protocol Comparison

Fig 3 — Feature comparison of MQTT/TCP, MQTT/UDP, and XEUPD

Deployment & Future Roadmap

Production Setup
  • Default UDP port: 1774
  • Load-balanced UDP server clusters
  • Optional MQTT bridge for legacy systems
  • MTU-aware packet sizing (1472B Ethernet)
  • High-performance Java library for easy integration
Future Enhancements
  • Full MQTT QoS parity
  • Adaptive congestion control
  • Broker clustering support
  • Cloud-native integration
  • Advanced TLS offloading security