Post topics, source code that relate to the Arduino Platform

User avatar
By jmv_driver
#41115 Hi!
I'm trying to use some api to communicate using the MQTT protocoll.

I tried the Adafruit MQTT Library, MQTT by Joel Gaehwiler, PubSubClient, ... but with any of these libraries are correctly working.

Can someone advise me the best/rocksolid library to use with esp8266? A appreciate one example of publishing and subscribing using the free broker test.mosquitto.org.


Thanks,

Jaime
User avatar
By Andrew Grande
#41160 MQTT is a pretty stable tech by now, libraries don't differ much. I've had good results with pubsubclient, see https://github.com/aperepel/iot-mqtt-sp ... sleep-oled for example.

Basically, check the last commit date of the lib to see if it's active, review any forks and give bonus points if they took care of any esp8266-specific issues.
User avatar
By krzychb
#41166 @jmv_driver

I am aware about two version of library named PubSubClient, so the question is which one you use.

For esp8266/Arduino I am using PubSubClient - MQTT library by @Imroy - https://github.com/Imroy/pubsubclient
    * A pretty detailed guide how to use it with test.mosquitto.org is here.
    * There is another project using test.mosquitto.org but without a guide - if you prefer to analyse the code yourself :D
Both projects are working without any issues or tricks to compile for several weeks with stable esp8266/Arduino 2.0.0 release.


Hope it helps,

Krzysztof
User avatar
By piersfinlayson
#41167 I like tuanpmt's esp_mqtt https://github.com/tuanpmt/esp_mqtt. Seems pretty fully functional, and works well with mosquitto.

Now this isn't natively Arduino capable, but I did make some modifications to it to allow it to run in the Arduino environment, alongside other Arduino tasks using the TaskScheduler library.

If people are interested i can make this code available.

I've moved away from the Arduino framework now to using the SDK directly as it's more powerful and I find it more stable.