There are many ways to handle it, but you need to consider how to
present it to your users and other constraints specific to your
environment.

In one GWT app, I did nothing to detect client-side inactivity. I used
the Google UserService to detect session expiration on the server side
whenever there was a message from the client (and I wrote the code to
handle those case). The Google UserService lets you see the policy on
how long the sessions stay active, but it is often measured in days.
So, it did not seem worthwhile to write code to handle the session
expiration.

Here's a link to a client-side that attempts to detect session
expiration:

http://gwt-ext.com/forum/viewtopic.php?t=1682

The code uses GWT-Ext widgets, but can be easily adapted to use
standard GWT widgets.

Some servers consider a client's session inactive if they have not
received a message from the client in some period of time (as shown in
the example). The example code can be adapted to periodically send a
"ping" message to the server instead of just detecting messaging
inactivity. You probably do NOT want clients sending "pings" to you
application if it is deployed on Google's servers, since the pings
will probably count against you request quota.

Another thing to consider is that if your application is working
correctly, the user may not even be aware when messages are exchanged
between client/server. For this reason, you may want to introduce some
other means of tracking inactivity.

Lastly, you need to determine how you want session expiration
presented to your user. My users did not care for the way the GWT-Ext
example informed the user (particularly if they missed the refresh
prompt). My solution was to keep the user at the same screen and
present a dialog box informing them when their session timed out. Upon
acknowledging the message, they were sent to another place.

I tried to hit the highlights of things for you to consider regarding
session expiration, but I think you need to tailor your solution for
your environment.


Regards,
Rick

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to