--- layout: default title: Arduino Client for MQTT ---

This library provides a client for doing simple publish/subscribe messaging with a server that supports MQTT v3.

For more information about MQTT, visit mqtt.org.

Download

The latest version of the library can be downloaded from GitHub.

Documentation

The library comes with a number of example sketches. See File > Examples > PubSubClient within the Arduino application.

Full API Documentation

License

This library is released under the MIT License.

Change History

The complete change history is available on GitHub.

1.9
  • Do not split MQTT packets over multiple calls to _client->write()
  • API change: All constructors now require an instance of Client to be passed in.
  • Fixed example to match 1.8 api changes - dpslwk
  • Added username/password support - WilHall
  • Added publish_P - publishes messages from PROGMEM - jobytaffey
1.8
  • KeepAlive interval is configurable in PubSubClient.h
  • Maximum packet size is configurable in PubSubClient.h
  • API change: Return boolean rather than int from various functions
  • API change: Length parameter in message callback changed from int to unsigned int
  • Various internal tidy-ups around types
  • Able to specify server address by DNS name
1.7
  • Improved keepalive handling
  • Updated to the Arduino-1.0 API
1.6
  • Added ability to publish retained messages
1.5
  • Added default constructor
  • Fixed compile error when used with arduino-0021 or later
1.4
  • Fixed connection lost handling
1.3
  • Fixed packet reading bug
1.2
  • Fixed compile error when used with arduino-0016 or later
1.1
  • Reduced size of library
  • Added support for Will messagesClarified licensing – see LICENSE.txt
1.0
  • Only Quality of Service (QOS) 0 messaging is supported
  • The maximum message size, including header, is 128 bytes
  • The keepalive interval is set to 30 seconds
  • No support for Will messages