bokeh.server.asgi#

A framework-neutral ASGI frontend for Bokeh server applications.

class BokehASGI(applications: Mapping[str, Application | ModifyDoc | PathLike] | Application | ModifyDoc | PathLike, *, prefix: str | None = None, redirect_root: bool = True, auth_policy: AuthPolicy | None = None, **kwargs: Any)[source]#

Host one or more Bokeh applications using the standard ASGI protocol.

This class does not depend on an ASGI framework or server. It can be served directly by Uvicorn or Hypercorn, or mounted in another ASGI app. Applications may be supplied as Application objects, document-modifying callables, or paths to Bokeh application scripts or directories. Script and directory applications are executed once for every new session. Supply an AuthPolicy to authenticate dynamic HTTP and websocket requests without depending on an ASGI framework.

async update_sessions(app_path: str, update_document: Callable[[Document], None | Awaitable[None]]) None[source]#

Update every active session document for an application.

This is a convenience wrapper for update_sessions().

Parameters:
  • app_path – The configured application path whose sessions are updated.

  • update_document – A synchronous or asynchronous callable that receives one session Document with its document lock held.

See AuthPolicy for framework-neutral authentication of ASGI HTTP and websocket requests.