PicoMQTT is a lightweight MQTT library for Arduino/PlatformIO optimized for ESP8266 and ESP32. It not only supports the MQTT Client mode like most existing solutions but also the MQTT Broker mode which transforms an ESP8266 or ESP32 board into an MQTT gateway replacing a Raspberry Pi board or an IoT gateway typically used for this task.
The library follows MQTT 3.1.1 specification, supports the publishing and consuming of arbitrary-sized messages, can deliver thousands of messages per second, and supports easy integration with the ArduinoJson library to publish and consume JSON messages.