Is it possible in Bokeh to check if session is active? I'm drawing live data streamed from other thread, I want to stop streaming as soon as client closes session (e.g. closes tab).
Note that destruction of expired sessions is a task that happens periodically (at a configurable interval) so the hook will not execute immediately at a session disconnect.
发布评论
评论(1)
您可以使用文档中所述的
on_session_destroyed
lifecycle钩子:https://docs.bokeh.org/en/latest/docs/docs/user_guide/server/server.html#lifecycle-hooks
请注意,销毁过期的会话是发生定期(以可配置的间隔),因此在会话断开连接时挂钩不会立即执行。
You can use the
on_session_destroyed
lifecycle hook as described in the documentation:https://docs.bokeh.org/en/latest/docs/user_guide/server.html#lifecycle-hooks
Note that destruction of expired sessions is a task that happens periodically (at a configurable interval) so the hook will not execute immediately at a session disconnect.