MQTT 💬 ESP32 Next-Level Library - Using PubSubClient.h

Опубликовано: 09 Август 2026
на канале: OhioIoT
741
39

PubSubClient is still the de facto standard for setting up MQTT on ESP32. It hasn't been updated in five years, it has a lot of blocking code, but... it's effective, and I don't know if there is a faster way to get you going on MQTT.

In this video, I build entire MQTT library from scratch. It combines the concepts described in each of the last four videos - 🎬 Video Links:
Connecting:    • MQTT - 💬 ESP32 Connect Using PubSubClient.h  
Publishing:    • MQTT - 💬 ESP32 Publish Using PubSubClient.h  
Subscribing:    • MQTT - 💬 ESP32 Subscribe Using PubSubClient.h  
Message Handling:    • MQTT - 💬 ESP32 Message Handler - PubSubCli...  

For more on "All Things IoT" — 🔔 Subscribe

⏱️ Chapters:
0:00 - Intro & Today's Plan
1:01 - Confirm the Working MQTT Connection
1:26 - Initialize the MQTT module
2:28 - Connect
8:13 - Publish
13:20 - Subscribe
17:10 - Handle Messages
21:46 - Outro

🛠️ What You'll Learn In This Video:
How to write elegant reconnect logic when connecting
How to publish several datatypes without having to do data transformations in your code each time
How to inject your subscriptions into your library so your library re-subscribes for you automatically each time it reconnects
How to inject your message handler into your library so that it's called with topic and payload, rather than you having to transform the incoming message each tie


🖥️ Code Examples:
Start Point: https://github.com/OhioIoT-MQTT-Examp...
End Point: https://github.com/OhioIoT-MQTT-Examp...

🔗 Resources:
PubSubClient library: https://github.com/knolleary/pubsubcl...



****************************************************************************************************
****************************************************************************************************

OhioIoT is an IoT platform designed and built for small-scale IoT projects (https://www.ohioiot.com).

If you are interested in building IoT systems, checkout the page and leave your email, so we can
discuss. -Larry

****************************************************************************************************
****************************************************************************************************