Send alert to user on websocket disconnect

I would like to have a popup appear over the screen to inform the user that the session is no longer available if there’s been a websocket disconnect, similar to what’s shown here:

This way, the user won’t be getting frustrated clicking around on an inactive page.

I’m wondering if anyone has any ideas for how this can be done using Bokeh server. This obviously can’t be done with the on_session_destroyed() lifecycle hook, since that doesn’t get called until after the session was also disconnected. I’m supposing I’d have to write some independent JavaScript code…any hints for how I could start looking into how to do this?

Just FYI, in the example given above, the code to call that popup is written in line 183 of https://github.com/phoebe-project/phoebe2-ui/blob/88ac87e324252229d610850805f8bb2a7172390d/src/App.js. However, that app uses React, not Tornado.

This is still currently an open issue: