Uniform Bokeh Server Client Side


I have a suite of multiple sensors that are sending data to a laptop over eithernet. This data is then put in a live bokeh table. What I have noticed in my testing is that each new client connected makes a different instance of the bokeh table. I am worried that multiple instances will pull data from the socket buffer on their own, thus leading to spotty data collection per user.

I have been looking at:
Running a Bokeh server — Bokeh 2.4.3 Documentation.


along with others. It sounds like I can use bokeh.client for this and just pretend multiple instances are one user, but I heard that was not recommened. I have been looking at Flask and that has also lead to multiple errors. The main reason I am struggling is my bokeh code, takes user input (controls what tables the user wants to see), and also pushes socket inputs to the live bokeh table.

Thanks for the help.

I’m a little unclear on the architecture/requirements. It sounds like you have some stream of external telemetry coming in from different sources, and you want every app session that starts up to present the same, complete view of that data, is that correct? If so my first suggestion would be to not pull the data from inside the app code itself, since that means every session gets/updates the data independently. Bokeh has various lifecycle hooks, e.g. an “on server start” hook that you can use to set up or update central data structures (say, via a thread) that all sessions can then refer to. For an example, see the spectrogram and how it handles audio data