In the log I see a bokeh error “Token is expired”.
[2023-12-01 22:26:26,903 | INFO | tornado.access] 101 GET /My_App/ws?theme=dark (172.30.0.8) 1.36ms
[2023-12-01 22:26:26,903 | INFO | bokeh.server.views.ws] WebSocket connection opened
[2023-12-01 22:26:26,904 | ERROR | tornado.application] Uncaught exception GET /My_App/ws?theme=dark (172.30.0.8)
HTTPServerRequest(protocol='http', host='foo.bar.dev', method='GET', uri='/My_App/ws?theme=dark', version='HTTP/1.1', remote_ip='172.30.0.8')
Traceback (most recent call last):
File "/home/pyvenvs/scratch-3.10/lib/python3.10/site-packages/tornado/websocket.py", line 937, in _accept_connection
open_result = handler.open(*handler.open_args, **handler.open_kwargs)
File "/home/pyvenvs/scratch-3.10/lib/python3.10/site-packages/tornado/web.py", line 3290, in wrapper
return method(self, *args, **kwargs)
File "/home/pyvenvs/scratch-3.10/lib/python3.10/site-packages/bokeh/server/views/ws.py", line 149, in open
raise ProtocolError("Token is expired.")
bokeh.protocol.exceptions.ProtocolError: Token is expired.
Is it possible to catch this error and open a pop up notification like pn.config.disconnect_notification with a link to reload the page? Is this related to command line setting session-token-expiration?
The problem is that when a Token expires it doesn’t present itself as websocket disconnection event and the notification doesn’t pop up (as hopefully is evident from my earlier screenshot; although admittedly the bottom is chopped off there).
I’ll try and put a feature request together soon. It looks like it might require a change in Bokeh rather than Panel although I’m not entirely sure. Thanks for the suggestion.
I’ve also traced the parameter “–session-token-expiration” and it seems to originate from Bokeh. From the code there, I’ve gleaned that it defaults to 300 seconds (DEFAULT_SESSION_TOKEN_EXPIRATION). I’ll try and increase this too.
Did increasing that value work for you? I am looking for ways to keep my app from timing out and needing to refresh, because I may lose all of the data that I had loaded in when I refresh the page. Thanks.