How to capture ProtocolError("Token is expired.") and offer notification

Thanks for the suggestion but I already do that; I should have been more explicit in my question. I actually do this:

pn.config.disconnect_notification = """
    Server Connected Closed <br /> 
    <button class="btn btn-outline-light" onclick="location.reload();">Click To Reconnect</button>
"""
pn.config.ready_notification = "Application fully loaded."

which I borrowed from this post.

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

1 Like