benstpierre
benstpierre

Reputation: 33571

Elegant way to detect if GWT application is out of date and auto-refresh browser?

After many support cases we are realizing the biggest problem we have with our GWT-based application is that users are leaving it open for weeks at a time. This means when we do a hotfix every week or two the RPC stubs are out of sync and cause silent exceptions to be thrown making the site look "broken". Does anybody know of a way to auto-detect and avoid this issue? A few ideas I have had are...

  1. On catching an RPC mismatch exception refresh the browser.
  2. When loading the host page inject the version number in source control the build came from, have a status checker/timer that check that the number did not change. When it does reload.
  3. Reload on an arbitrary timer (perhaps twice daily).

Any ideas?

Upvotes: 9

Views: 884

Answers (2)

user2608031
user2608031

Reputation: 1

Implement security that logs users out after an hour of idle time. Assuming your releases are overnight or on weekends, the users are logging in after the release. No need to refresh the app. this is viable especially if your site eventually needs users to login.

Upvotes: 0

Prasith Govin
Prasith Govin

Reputation: 1277

I'd like to present a fourth option.

Create an RPC Proxy and UI Object proxy that all UI requests and RPC requests are routed through. This way whenever this proxy detects that something is out of date it can dynamically load the widget or change it's expected RPC models.

This is pretty how Vaadin does things and it works great. Vaadin is a UI toolkit built on GWT in case you're not aware. We have several long running production applications using this over the last couple of years and we have made some tweaks in their UI Def language (UIDL) to add version mismatch.

This diagram is a good representation of what they do and if you don't want to build something like this yourself I'd of course recommend moving to Vaadin.

Vaadin Client Side Architecture

Upvotes: 1

Related Questions