Awesome
Asynchronous ArduinoIDE MQTT 3.1.1 client library for ESP8266, ESP32
Licence: Creative Commons: Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) Legal Text
N.B. This licence expressly prohibits commercial use
If you are able, please Support me on Patreon and/or subscribe to my Youtube channel (instructional videos)
Version 0.0.1 Release Notes
Other Documents
- Getting Started
- Payload Handling and "expert" functions
- Full API specification
- Using TLS
- Challenges of embedded MQTT
Features
- Full* MQTT v3.1.1 Qos0/1/2 compliance, session management and recovery
- Payload size limited only by available heap (~20kB on ESP8266, ~120kb on ESP32)
- TLS support (ESP8266 only)
- Compile-time multilevel diagnostic
- Utility functions to view binary payloads and handle as:
- C-style string (
char*
) std::string
- Arduino
String
- < any arithmetic type >
- C-style string (
- Full error-handling including:
- QoS failures*
- Subscribe failure
- "Killer" packets ( > free available heap) both inbound and outbound
NB *No device can fully comply with MQTT 3.1.1 QoS unless it has unlimited permanent storage to hold failed QoS messages across reboots. For more in-depth explanation of the reasons, read Challenges of MQTT QoS on embedded systems
Performance
Features you may not find in other libraries:
Large Payloads
H4AsyncMQTT automatically fragments outbound packets and reassembles inbound packets of any size up to about 1/2 the free heap. User code simply gets a copy of the full packet - irrespective of its size - without any fuss and requiring zero code on the user's part.
Full QoS1 / QoS2 compatibility / recovery
H4AsyncMQTT's author is unaware of any similar libraries for ESP8266/ESP32 that fully and correctly implement QoS1/2 in all circumstances.
They may sometimes work, e.g. with only small packets and/or slow send rates but fail when either increases. None will correctly recover "lost" messages on unexpected disconnect. Given that this is pretty much the only purpose of QoS1/2 then any library not fulfilling this promise cannot legitimately claim to be QoS1/2 compatible. If a library does not do this:
Then it does not support QoS1/2 no matter what claims it may make.
The "menagerie" roadmap
H4AsyncMQTT is one of a family of firmware packages for simple robust and rapid asynchronous IOT development on ESP8266 / ESP32
SEE Installation
The related / dependent libraries
Name | Provides | Notes | |
---|---|---|---|
Forked AsyncTCP | "Glue" to LwIP (ESP8266) | Important bugfixes | |
Forked ESPAsyncTCP | "Glue" to LwIP(ESP32) | Missing features added | |
Forked ESPAsyncWebserver | Basis of webUI in H4Plugins | Several major bugfixes | |
PMB Tools | '32/'8266 HAL and utility functions | ||
H4AsyncClient | Simple Large-payload Async TCP | API-compatible with ESPAsyncTCP, seamless TLS/SSL | |
H4AsyncMQTT | Async MQTT Client | QoS 0/1/2 Fully 3.1.1 compliant. Large payloads | |
ArmadilloHTTP | Async HTTP/S Client | Simple send/callback of large payloads | |
H4 | Scheduler/Async Timers | ||
H4/Plugins | Full Async IOT Firmware | Webserver, MQTT, OTA, NTP, HTTP etc etc |
H4AsyncMQTT installation path
Compiling
Installation
Please see H4 Installer
Issues
If you want a quick resolution, please follow these rules:
-
As with all H4 and H4Plugins libraries, please make sure you have read all the relevant documentation relating to the issue and watched any videos on the Youtube channel (instructional videos). Please also subscribe to the channel for notifications of news and updates.
-
If you still think there is a problem, then join the Facebook H4 Support / Discussion group and report the issue briefly there. This is because I visit the group every day, whereas I do not have time to visit 11 github repos every day. Furthermore, it alerts other users to potential problems and allows an initial assessment.
-
If there is a genuine issue then you will be referred to Raising H4/H4Plugins issues after which you are advised to create a full github issue report.
-
Failing to make an initial report in the Facebook H4 Support / Discussion group and simply starting with a github issue, or failing to include all of the information required in Raising H4/H4Plugins issues is likely to result in a long delay before it gets picked up.
(c) 2021 Phil Bowles h4plugins@gmail.com