Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

gwt

gwt-rpc

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?

like image 947
benstpierre Avatar asked Apr 23 '12 21:04

benstpierre


1 Answers

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

like image 144
Prasith Govin Avatar answered Oct 08 '22 15:10

Prasith Govin