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

2

9

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?

Carditis answered 23/4, 2012 at 21:48 Comment(2)
I would go with option 1 as it will be consistently an IncompatibleRemoteServiceException. Catch that, give them a nice error message and location.reload(true);.Breather
As per the javadoc, IncompatibleRemoteServiceException is not thrown when you simply change the implementation of a service method without adding or removing fields. So, I go with the my version of option 2: Have the build number at the client side. Each GWT RPC call should send this build number to the server. You can check if the build number is latest at the server side, if not you can refresh the page.Nutting
H
1

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

Haggadist answered 10/5, 2012 at 18:43 Comment(0)
B
0

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.

Bartizan answered 22/7, 2013 at 19:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.