☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Problem terminating an embedded bokeh server's session immediately after closing the browser's tab

Community Support
sima
sima

Hello,

I’m embedding bokeh server in a flask web application, using the autoload_server method for different bokeh applications in that server.

I have different bokeh documents embedded in the same html page, and when an outer change occurs, i send different update functions to the add_next_tick_callback of the different documents.

I has multiple users, so in order to track which documents needs to be updated when an outer change occurs, i transfer a unique id as the session_id to the autoload_server method, and keep that id as a flask session variable.

The problem is that if a user closes the browser’s tab, the bokeh sessions isn’t deleted immediately, so if the user opens a new tab and enters the application again (without waiting a minute or so), autoload_server is called with a session id of an existing session, which causes problems.

I tried calling the request_expiration method on each session i create, but the session still isn’t deleted immediately by the bokeh server when the browser’s tab is closed. is there a way to terminate it immediately?

Thanks for your help.

⌁   Link to post
Bryan
Bryan

You probably want these options:

  http://bokeh.pydata.org/en/latest/docs/user_guide/cli.html#session-expiration-options

Thanks,

Bryan

···

On Apr 30, 2017, at 03:25, sima <sima@jether-energy.com> wrote:

Hello,

I'm embedding bokeh server in a flask web application, using the autoload_server method for different bokeh applications in that server.
I have different bokeh documents embedded in the same html page, and when an outer change occurs, i send different update functions to the add_next_tick_callback of the different documents.
I has multiple users, so in order to track which documents needs to be updated when an outer change occurs, i transfer a unique id as the session_id to the autoload_server method, and keep that id as a flask session variable.
The problem is that if a user closes the browser's tab, the bokeh sessions isn't deleted immediately, so if the user opens a new tab and enters the application again (without waiting a minute or so), autoload_server is called with a session id of an existing session, which causes problems.
I tried calling the request_expiration method on each session i create, but the session still isn't deleted immediately by the bokeh server when the browser's tab is closed. is there a way to terminate it immediately?

Thanks for your help.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/839044c8-811b-4c7b-b64c-e3bfbc9e4f15%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post

End of archived discussion · Replies are disabled