Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The general answer to issues of data staleness in a client is either polling, or server push (<a href="http://en.wikipedia.org/wiki/Comet_(programming)" rel="nofollow noreferrer">Comet</a>), depending on how important it is to have up-to-date information.</p> <p>With polling, your client sends a request for fresh information every N minutes and shows the updated data in the UI (preferably not reloading the whole UI, just parts that have updated).</p> <p>With server-pushing, your client has a persistent open connection to the server, reconnecting as soon as the connection times out, and whenever the server has new data to tell the client, it does so immediately. This has the advantage of less staleness in the client, but more overhead in total because of all of these persistent connections being made.</p> <p>Locking is difficult, because it requires a lot of coordination among all parties. The server has to tell the second client to ask for a model that it is locked, then tell it again when it's unlocked, and the client has to know whether it still wants to make a change at all (what if user-A made the same change user-B wanted to make?). In general keeping all clients as up-to-date as is reasonable is the best answer.</p> <p>To work with your example, after user-A updates a model, the server publishes to anyone who cares that the model has been changed, and user-B's client updates accordingly. Same when user-B updates the model, user-A can tell right away (or after their client polls again).</p> <p>The <a href="http://code.google.com/p/rocket-gwt/" rel="nofollow noreferrer">rocket-gwt</a> project includes support for Comet, and I've heard good things about it, though I've never tried it myself.</p> <p>A similar option, though not immediately usable, is <a href="http://dev.w3.org/html5/websockets/" rel="nofollow noreferrer">HTML5 WebSockets</a>, which removes the need for a persistent connection to the server by opening a specialized direct "channel" between the server and the client. Unfortunately, WebSockets are currently only supported on a small subset of browsers. Hopefully as adoption grows this will be a better option. That being said, if you want to use WebSockets in GWT, I have written <a href="http://github.com/ImJasonH/websocket-gwt" rel="nofollow noreferrer">some code</a> to do it (shameless self-promotion)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload