I have found that when the websocket connection dies, Panel dashboards become unresponsive until the user refreses the page.
On cloud run, for example, the server will shut down after a few minutes of user inactivity.
Is there a way to have a front end component that could alert the user that the connection has been dropped and they need to refresh?
I did have one approach where there is a panel component that updates a front end variable every minute or so; and then I had front end code to regularly check that the variable was updated. But it felt super convoluted and didnt quite work.
Is there best practice here?
Thank you kindly
This functionality was just added in Panel 1.2.1. Check out Add notifications on connect and disconnect — Panel v1.2.1
As this is brand new please provide feedback if this works for you. Request for improvements should be posted on GitHub. Thanks
Hi @Marc, this is great - thank you very much. Looks really nice.
One note is that I was able to add HTML inside the message area; which allowed me to include a button users can click that refreshes
disconnect_notification="""Server Connected Closed <br /> <button class="btn btn-outline-light" onclick="location.reload();">Click To Reconnect</button> """
And it works nicely.
Greatly appreciate the effort to keep moving this project forward