✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

How can I use paho MQTT client and live update of dash?


I want to receive data from MQTT broker using paho-mqtt library. I want to display data on a live graph using plotly.
I wrote already a small script and it receives json-data from MQTT. I can olsa run “live update” example from dash documentation. But I don’t know how can I combine these two processes and how can I display MQTT data?


Ok I solved my own question :slight_smile:

I was using client.loop_forever() function in paho mqtt library. This function is blocking and main thread doesn’t continue.
I used client.loop_start(). This function starts the loop in another thread and main thread can continue.