MQTT over UDP — Lightweight IoT Messaging Protocol

Protocol v1.1 · May 2026

MQTT over UDP is a lightweight, low-latency messaging protocol delivering MQTT-style publish/subscribe communication over UDP instead of TCP. It combines MQTT semantics (topics, payloads) with UDP speed (low overhead) and a custom application-level reliability layer — purpose-built for IoT telemetry, edge systems, industrial automation, and constrained devices.

Low Latency

Removes TCP connection overhead — ultra-fast delivery for time-critical IoT telemetry and industrial automation where every millisecond counts.

Custom Reliability

Application-level ACK, retry, and fragmentation/reassembly ensure delivery guarantees without TCP's heavy connection state overhead.

Constrained Devices

Compact binary packets with minimal memory and CPU footprint — ideal for embedded MCUs, low-power sensor nodes, and edge gateways.

Use cases
IoT telemetry — sensors and medical devices
Real-time industrial monitoring systems
Edge computing and factory automation
High-frequency, low-latency messaging pipelines
Constrained devices with limited memory/CPU
Mobile and unstable network environments

System Architecture

Client · Broker · Subscribers

Clients construct MQTT-style payloads, fragment them into UDP segments, and transmit with an application-level reliability layer. The broker validates, buffers, and reassembles before dispatching to subscribers.

IoT Client
  • Payload Builder
  • Fragmentation Engine
  • Reliable UDP Sender
  • ACK / Retry Handler (QoS 0/1/2)
  • HMAC-SHA256 Authentication
UDP Broker
  • UDP Listener (Port 1774)
  • Packet Validator + CRC Check
  • Reassembly Engine
  • Message Dispatcher
  • Auth + Signature Verification
Subscribers
  • Sensor / Edge Applications
  • Real-time Dashboards
  • Cloud MQTT Bridge
  • Alert & Notification Systems
  • Data Logging Pipelines
MQTT over UDP Architecture
Fig 1 — MQTT over UDP System Architecture (Protocol v1.1, Author: Ajith Kumar)

Packet Format Specification

30-byte fixed header + variable RawData

Each UDP packet consists of a fixed 30-byte binary header followed by variable-length RawData carrying the MQTT topic and payload. Minimum packet size is 32 bytes (header only); MTU target is 1472 bytes for standard Ethernet.

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 bytes
RawData payload format
[ TopicLen: 2B ] → [ Topic: UTF-8 string ] → [ PayloadLen: 2B ] → [ PayloadData: UTF-8/Binary ]
Packet constraints & QoS levels
32 B
Min packet (header only)
1472 B
Recommended MTU target
65 KB
Max packet size
0 / 1 / 2
QoS levels supported
Message types
CodeTypeDirection
0x0001MSG_PUBLISHClient → Server
0x0002MSG_SUBSCRIBEClient → Server
0x0003MSG_UNSUBSCRIBEClient → Server
0x0004MSG_PINGREQClient → Server
0x0005MSG_CONNECTClient → Server
0x0006MSG_DISCONNECTClient → Server
CodeTypeMeaning
0x1001ACK_SUCCESSSegment acknowledged
0x1002ACK_COMPLETEFull message received
0x2001NAK_AUTH_FAILAuth failure
0x2002NAK_INVALID_SEGBad segment number
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 & Security Model

ACK · DTLS · HMAC-SHA256
Reliability mechanisms
Timeout-based retransmission with retry limits
Sliding window — 4–7 segments recommended
Deduplication via DeviceID + Timestamp + SegNum
Segment-index based message reassembly
CRC16-CCITT fast data integrity validation
Session recovery across network disruptions
Security architecture
DTLS encryption — recommended for production
Optional AES payload encryption
HMAC-SHA256 packet signature per message
Token-based device authentication
Timestamp-based replay attack mitigation
CRC + signature combined integrity check

Protocol Comparison

MQTT/TCP · MQTT/UDP · XEUPD

XEUPD (eXtended Enhanced UDP Protocol) is Kayil Systems' production-hardened implementation — bridging the gap between UDP speed and enterprise-grade reliability. It addresses every UDP limitation while maintaining the speed advantage over TCP-based MQTT.

FeatureMQTT / TCPMQTT / UDPXEUPD (Our Protocol)
TransportTCPUDPUDP + Reliability Layer
ConnectionStateful (3-way HS)ConnectionlessSession-aware over UDP
ReliabilityBuilt-inNoneCustom ACK + Retry
LatencyModerateVery LowUltra-Low
Protocol OverheadHighMinimalLow — optimised
FragmentationTCP/IP StackApp responsibilityIntelligent engine
Packet LossAuto retransmitDropped silentlySelective retransmission
ScalabilityMediumVery HighExtremely High
Broadcast/MulticastLimitedSupportedNative optimised
IoT SuitabilityGoodVery GoodExcellent
SecurityTLSDTLS / CustomXEUPD Secure Layer
Best Use CasesStandard MessagingGaming, VoIPIoT, Medical, Telemetry
Protocol Comparison
Fig 3 — Protocol comparison: MQTT/TCP vs MQTT/UDP vs XEUPD

Deployment & Future Roadmap

Production · SDK · 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 available
Available via Kayil Systems SDK
Future enhancements
Full MQTT QoS parity
Adaptive congestion control
Broker clustering support
Cloud-native integration layer
Advanced TLS offloading
WASM runtime for browser IoT