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.

Use Asynchronous Callbacks
Defer Bound Functions Until Load

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

Defer Bound Functions to Improve the User Experience
Defer Callbacks Until Load

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

Defer Long Running Tasks to Improve the User Experience
Periodically Run Callbacks

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

Periodically Run Callbacks
Run Tasks at Session Start or End

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

Run Tasks at Session Start or End
Schedule Global Tasks

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

Schedule Global Tasks
Modify Bokeh Models

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

Modify Bokeh Models
Connection Notifications

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

Add notifications on connect and disconnect

Examples#

Streaming Bokeh

Use add_periodic_callback to stream data to a Bokeh plot.

Streaming Bokeh
Streaming Indicators

Use add_periodic_callback to stream data to Trend indicators.

Streaming Indicator
Streaming Perspective

Use add_periodic_callback to stream data to a Perspective pane.

Streaming Perspective
Streaming Tabulator

Use add_periodic_callback to stream data to a Tabulator widget.

Streaming Tabulator