Arduino Library – pubsubclient
Installatie van Arduino IDE libraries: Arduino info
Arduino Client for MQTT
This library provides a client for doing simple publish/subscribe messaging with a server that supports MQTT.
The library comes with a number of example sketches. See File > Examples > PubSubClient within the Arduino application.
Full API documentation is available here: http://pubsubclient.knolleary.net
- It can only publish QoS 0 messages. It can subscribe at QoS 0 or QoS 1.
- The maximum message size, including header, is 128 bytes by default. This is configurable via
- The keepalive interval is set to 15 seconds by default. This is configurable via
- The client uses MQTT 3.1.1 by default. It can be changed to use MQTT 3.1 by changing value of
The library uses the Arduino Ethernet Client api for interacting with the underlying network hardware. This means it Just Works with a growing number of boards and shields, including:
- Arduino Ethernet
- Arduino Ethernet Shield
- Arduino YUN – use the included
YunClientin place of
EthernetClient, and be sure to do a
- Arduino WiFi Shield – if you want to send packets > 90 bytes with this shield, enable the
- Sparkfun WiFly Shield – library
- TI CC3000 WiFi – library
- Intel Galileo/Edison
The library cannot currently be used with hardware based on the ENC28J60 chip – such as the Nanode or the Nuelectronics Ethernet Shield. For those, there is an alternative library available.
This code is released under the MIT License.
Revert breaking change to callback signature
Add a library.json file for PlatformIO
Handle dns failure on connect properly
Made use of callback std::function ESP8266-specific
Allow existing #-defines to be predefined
Add MQTT_SOCKET_TIMEOUT to prevent it blocking indefinitely whilst waiting for inbound data
Fixed return code when publishing >256 bytes
Add publish(topic,payload,retained) function
Change code layout to match Arduino Library reqs
Add MAX_TRANSFER_SIZE def to chunk messages if needed
Reject topic/payloads that exceed MQTT_MAX_PACKET_SIZE
Add (and default to) MQTT 3.1.1 support
Fix PROGMEM handling for Intel Galileo/ESP8266
Add overloaded constructors for convenience
Add chainable setters for server/callback/client/stream
Add state function to return connack return code