散景检查会话是否活动

发布于 2025-02-09 12:56:41 字数 155 浏览 1 评论 0 原文

bokeh 检查会话是否处于活动状态?我正在绘制从其他线程流的实时数据,我想在客户端关闭会话(例如关闭选项卡)后立即停止流式传输。

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).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏末染殇 2025-02-16 12:56:41

您可以使用文档中所述的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文