// the find
256dpi/arduino-mqtt
MQTT library for Arduino
A thin Arduino wrapper around the author's own lwmqtt C library, giving you MQTT 3.1.1 on microcontrollers. Works across ESP8266, ESP32, MKR boards, and anything else that implements Arduino's Client interface. The target audience is anyone building IoT devices that need to talk to an MQTT broker without pulling in a heavier framework.
The underlying lwmqtt library is a proper C implementation, not a hack — it handles QoS 0/1/2, will messages, clean sessions, and keep-alive correctly. Publishing payloads larger than the write buffer is handled by streaming the bytes directly since v2.5.2, so you're not stuck at 128 bytes for outbound messages. The custom clock source callback is a genuine quality-of-life addition for deep-sleep applications where millis() stops ticking. The `dropOverflow()` + `droppedMessages()` counter pair is honest about what happens when incoming messages exceed the read buffer, rather than silently corrupting state.
MQTT 5.0 is not supported — if your broker requires it (HiveMQ Cloud's newer defaults, for example), you're out of luck. The 128-byte default read buffer bites people constantly; it's documented, but the error mode is silent message drops, not an obvious failure. Reconnection logic is completely left to user code — the examples show a blocking while loop that will freeze your sketch if WiFi is flaky, and there's no built-in exponential backoff or non-blocking reconnect helper. QoS 2 support relies on the broker side being correct; the `prepareDuplicate` API for retry logic is low-level enough that most users will get it wrong or skip it entirely.