Updating Data on dashboard using Socket.io connection

Hi everyone,

I’m currently trying to make use of socket.io to connect to upload data every 20-30 seconds from a socket.io server to update a plot to track a scientific instrument. Does anyone know if this is something that is supported and/or if there is a better alternative? I’ve implemented the below solution.

I implemented this version below. The problem is that I’d like a plot to update with the information as well as update some text on the dashboard with some info as well. Currently it just updates the session information value but I doesn’t effect the visuals without a rerun.

(edit) Since I’ve figured out you can store the socket.io client in the session_state as well to enable you to maintain a single connection while using streamlit even during each rerun. I’m not sure how secure this is for critical connections but if using as a mostly local connection as I am this should work ok.

Best,
Kalamnaki