without closing window or (clicking logout button) how can we know a user a user has left the chat
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   srinivas_katkuri
Posted On:   Tuesday, September 25, 2001 02:25 AM

in a httpsession, how to find the difference between current system time and lastaccessed time.
i am getting the same value( in long) for both httpsession.getLastAccessedTime() and System.currentTimeMillis().
actually i have to find the ideal time the user passes.and i have to remove the user name from hashtable if i exceeds 1 minute. please let me know if u have any solution to this.
mail me to msamba@rediffmail.com

Re: without closing window or (clicking logout button) how can we know a user a user has left the chat

Posted By:   Alex_Chaffee  
Posted On:   Thursday, September 27, 2001 07:20 PM

You could add your own value every time the user hits your servlet.

Long previousHit = (Long)session.getAttribute("lastHit");
if (previousHit != null &&
(System.currentTimeMillis() - previousHit.longValue() > 60000) {
// whatever
}
else
{
session.setAttribute("lastHit", new Long(System.currentTimeMillis());
}


About | Sitemap | Contact