PubSubClient is a client library for Arduino that provides MQTT publish-subscribe messaging support.
The library solves the problem of enabling Arduino boards to communicate using the MQTT protocol. It works by implementing a lightweight MQTT client that connects to an MQTT broker, allowing Arduino sketches to publish messages and subscribe to topics. The implementation uses the Arduino Ethernet Client API, which provides compatibility across multiple network hardware options without requiring board-specific code.
Developers should be aware that the maintainer has stated the library is not actively maintained and recommends choosing an alternative library that is actively maintained. The tool suits projects using older Arduino hardware or those already invested in this library's API, but new projects should evaluate actively maintained alternatives. The library has notable constraints: it publishes only QoS 0 messages, supports subscription at QoS 0 or 1, has a default maximum message size of 256 bytes, and uses MQTT 3.1.1 by default. It works with a range of Arduino boards and shields including the Ethernet Shield, WiFi Shield, YUN, Galileo, Edison, ESP8266, and ESP32, though it cannot be used with ENC28J60-based hardware.
Almost all open issues are raised by outside users rather than the core team, indicating a substantial base of adopters reporting real-world use. Maintainers typically respond to new issues and pull requests within a few days.