I am new to Bokeh and want to run a Bokeh server which real time update graphs with new data. Specifically I want users to be able to go to a webpage and get a plot which updates with new data as it comes in.
I have copied the following example at bottom of message and I can run it the local machine per the directions here, http://bokeh.pydata.org/en/latest/docs/user_guide/server.html#userguide-server-output-server
However when I try to set up the server and access remotely it does not work. Note I have the ports and networking setup correct as I can use other static examples remotely but not this one.
I start the server with:
bokeh serve main.py --host 10.127.0.101:5006
Where main.py is code below and the 10.127.0.101 is the IP address of the machine I am hosting on.
If in the server window I hit “Ctrl-C” I can get the graph but no updates, I think it is locking up on the push_session() but not sure.
Does anyone have an example of how to run a similar example remotely?
import numpy as np from numpy import pi from bokeh.client import push_session from bokeh.driving import cosine from bokeh.plotting import figure, curdoc x = np.linspace(0, 4*pi, 80) y = np.sin(x) p = figure() r1 = p.line([0, 4*pi], [-1, 1], color="firebrick") r2 = p.line(x, y, color="navy", line_width=4) # open a session to keep our local document in sync with server session = push_session(curdoc()) @cosine(w=0.03) def update(step): r2.data_source.data["y"] = y * step r2.glyph.line_alpha = 1 - 0.8 * abs(step) curdoc().add_periodic_callback(update, 50) session.show() # open the document in a browser session.loop_until_closed() # run forever