Reload the page automatically when the web service is restarted

Hi

I use UDDashboard 2.9.0 with Windows PowerShell 5.1 during the current development still with the built in webservice, in the future with ISS.

Sometimes I restart the webservice for maintenance, changes on webpage or due the memory usage. In several offices I have some unattended screens, which shows the dashboard and they lose the connection (like UDMonitor) if I restart the webservice. I don’t want login every where and refresh the site manually. Is it possible to reload the page if the connection to the webservice was interrupted?

Best regards, fabian

Hello @xcabur and welcome to the UniversalDashboard forums! This is not automatically built into UniversalDashboard…however being around on this forum for a while there is this solution you could use to broadcast a message to all users:-

And I know @BoSen29 posted a fancy method using his Invoke-UDJavascript to refresh the page every x amount of seconds, but I cannot seem to find that post…hopefully the first link I posted will help you design a solution.

1 Like

Thanks for the shoutout @psDevUK!
The post you’re referencing is using the HTTP Meta Inf setting, to force the browser to relead the page.

Requires UDHelmet though.

Pure javascript to piggyback on the onclose event of the websocket:

window.UniversalDashboard.webSocket.onclose = function(event) { location.reload()};

Never tested the JS, but should work if you trigger it with invoke-udjavascript :slight_smile:

2 Likes

nice, thanks a lot.

1 Like