Register Session Callbacks#

These How-to pages provide solutions for common tasks related to setting up callbacks on session related events (e.g. on page load or when a session is destroyed) and defining periodic tasks.

Use Asynchronous Callbacks

How to leverage asynchronous callbacks to run I/O bound tasks in parallel.

Defer Bound Functions Until Load

How to defer execution of bound and displayed functions until the application is loaded with defer_load.

Defer Callbacks Until Load

How to set up callbacks to defer a task until the application is loaded with pn.state.onload.

Periodically Run Callbacks

How to set up per-session callbacks that run periodically.

Run Tasks at Session Start or End

How to set up callbacks when a session is created and destroyed.

Schedule Global Tasks

How to schedule tasks that run independently of any user visiting an application.

Modify Bokeh Models

How to safely modify Bokeh models to avoid running into issues with the Bokeh Document lock.

Connection Notifications

How to add notifications when the application is ready and when it loses the server connection.

Examples#

Streaming Bokeh

Use add_periodic_callback to stream data to a Bokeh plot.

Streaming Indicators

Use add_periodic_callback to stream data to Trend indicators.

Streaming Perspective

Use add_periodic_callback to stream data to a Perspective pane.

Streaming Tabulator

Use add_periodic_callback to stream data to a Tabulator widget.