bokeh.server

Provide a customizable Bokeh Server Tornadocore application.

The architecture of Bokeh is such that high-level “model objects” (representing things like plots, ranges, axes, glyphs, etc.) are created in Python, and then converted to a JSON format that is consumed by the client library, BokehJS. (See Defining Key Concepts for a more detailed discussion.) By itself, this flexible and decoupled design offers advantages, for instance it is easy to have other languages (R, Scala, Lua, ...) drive the exact same Bokeh plots and visualizations in the browser.

However, if it were possible to keep the “model objects” in python and in the browser in sync with one another, then more additional and powerful possibilities immediately open up:

  • respond to UI and tool events generated in a browser with computations or queries using the full power of python
  • automatically push server-side updates to the UI (i.e. widgets or plots in a browser)
  • use periodic, timeout, and asynchronous callbacks to drive streaming updates

This capability to synchronize between python and the browser is the main purpose of the Bokeh Server.

By far the most flexible way to create interactive data visualizations using the Bokeh server is to create Bokeh Applications, and serve them with a Bokeh server. In this scenario, a Bokeh server uses the application code to create sessions and documents for all clients (typically browsers) that connect:

../../_images/bokeh_serve.svg

A Bokeh server (left) uses Application code to create Bokeh Documents. Every new connection from a browser (right) results in the Bokeh server creating a new document, just for that session.

The application code is executed in the Bokeh server every time a new connection is made, to create the new Bokeh Document that will be synced to the browser. The application code also sets up any callbacks that should be run whenever properties such as widget values are changes.

The reference links in the sidebar document the details of the Bokeh Server. Most users will probably not need to be concerned with these details, unless they have specialized requirements, and should refer to the User’s Guide chapter Running a Bokeh Server for information about using the Bokeh Server.