Skip to content

HamzaHajeir/H4AsyncMQTT

 
 

Repository files navigation

mbm

Asynchronous Arduino MQTT 3.1.1 and 5.0 client library for ESP8266, ESP32, and RP2040


Licence: 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


Features

  • Full* MQTT v3.1.1, MQTT v5.0 Qos0/1/2 compliance, session management and recovery
  • Payload size limited only by available heap (~20kB on ESP8266, ~120kb on ESP32)
  • TLS support (ESP32 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 >
  • Full error-handling including:
    • QoS failures
    • Subscribe failure
    • "Killer" packets ( > free available heap) both inbound and outbound

Performance

perf


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/RP2040 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:

mqtt spec

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 / RP2040

SEE Installation

roadmap

The related / dependent libraries

Name Provides Notes
H4AsyncTCP TCP and TLS communication
H4AsyncWebServer Basis of webUI in H4Plugins Several major bugfixes
roadmap PMB Tools '32/'8266 HAL and utility functions
roadmap H4AsyncTCP Simple Large-payload Async TCP API-compatible with ESPAsyncTCP, seamless TLS/SSL
roadmap H4AsyncMQTT Async MQTT Client QoS 0/1/2 Fully 3.1.1 compliant. Large payloads
roadmap ArmadilloHTTP Async HTTP/S Client Simple send/callback of large payloads
roadmap H4 Scheduler/Async Timers
roadmap H4/Plugins Full Async IOT Firmware Webserver, MQTT, OTA, NTP, HTTP etc etc
H4Plugins_Env PlatformIO Development Environment With suitable versions across libraries

H4AsyncMQTT installation path

pango path


Compiling

performance


Installation

PlatformIO

One can get a homogeneous H4 Stack versions from the PlatformIO H4Plugins Environment. One can reuse the environment directly, or copy the parts of interest in the configuration file platformio.ini in a new project.

Arduino IDE

Simply download the zip of this repository and install as an Arduino library: Sketch/Include Library/Add .ZIP Library...

Up to come: See H4 Installer

Issues

If you want a quick resolution, please follow these rules:

  1. 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.

  2. 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.

  3. 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.

  4. 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 [email protected]