How to add endpoints (apps) to a running bokeh server?

I’m running a bokeh server which serves two different apps on two different endpoints. Is it possible to add more apps to the server programmatically without stopping the server?

I saw there’s a push_doc method in the bokeh.client.connection.ClientConnection class but I couldn’t make it work.

This is not currently possible.

Thanks for your quick reply!
It looked from the documentation that push_doc might be the solution but I guess it’s not. can you please explain what is it for?
hypothetically speaking, what if I would start the server with fictive endpoints (apps)? is it possible to overwrite an app (document) and modify the endpoint name?

No that would not be workable. A Bokeh application (associated with an endpoint) is really a factory for creating new Documents and sessions for those Documents. When the endpoint is hit, the app code is run and a new Document and session are created, and the browser is then connected to the session.

You can certainly push a new document and session to a running Bokeh server with the bokeh.client API, but:

  • they are not associated with any app endpoint, they just add a “free floating” session that someone could embed or connect to using the long, explicit session URL
  • any callbacks would not run on the Bokeh server! Tthe process that created and pushed the session could start its own blocking event loop so that it could service any callbacks. But this is very unwieldy, and is why the client API was never meant to be used this way