Is It Possible to Use Plotly Dash with Real-Time Data?

Hi everyone

I’m trying to build a real-time dashboard using Dash and Plotly. What’s the best way to handle live updates and streaming data? How can I ensure that the app updates the plots in real-time without causing performance issues?

Thanks!

Hi @JackShaw,

depending on your setup you can utilize the dcc.Interval component which triggers a callback with an interval you define. This is useful when you dont have any streaming endpoint.

If you already have a web-socket or server-side-event endpoint you can use the Websocket or SSE component from the dash-extensions package. Dash itself is not able to provide that functionality so you need a separate server which is able to run ws’s and sse’s like FastApi.

If you want to create the streaming endpoints yourself but keep everything in Dash, you could use my async fork of Dash which uses Quart instead of Flask and provides ws and sse out of the box.

Performance wise make sure you only send data you need and try to use clientside-callbacks.

Hope this helps!