DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
mqtt_sn.h File Reference

MQTT-SN v1.2 wire codec (DETWS_ENABLE_MQTT_SN) - zero-heap message builder + parser for MQTT for Sensor Networks, the UDP / non-TCP MQTT variant for constrained, lossy links (topic IDs instead of strings, gateway discovery, sleeping-client keep-alive). More...

#include "ServerConfig.h"

Go to the source code of this file.

Detailed Description

MQTT-SN v1.2 wire codec (DETWS_ENABLE_MQTT_SN) - zero-heap message builder + parser for MQTT for Sensor Networks, the UDP / non-TCP MQTT variant for constrained, lossy links (topic IDs instead of strings, gateway discovery, sleeping-client keep-alive).

Spec: MQTT-SN v1.2 (OASIS contribution). Each message is:

[Length][MsgType][message body...]
  • Length is 1 octet when the total message length (the Length field included) is <= 255; otherwise it is 3 octets: 0x01 then a big-endian uint16 total length.
  • All multi-byte integers (TopicId, MsgId, Duration) are big-endian (MSB first).
  • TopicId / MsgId are 2 octets; topics may be a registered numeric TopicId, a pre-defined TopicId, or a 2-character short topic name (per the Flags TopicIdType).

Verified against the Eclipse Paho MQTT-SN reference (message-type enum + length encoding) and the v1.2 spec. This is the wire codec only; the gateway connection, topic registry, and retransmission/sleep state are the application's.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file mqtt_sn.h.