Re: servlets and browsers

On Tue, 27 Oct 1998, Selma Harumi Takara wrote:

> Hi,
> 
> I'm developing a chat to be used for doctors using servlets, and 
> I have a problem: I need to be notified if the user closed the 
> window of the browser that is running the chat (trying to quit),
> and I'd like to know if someone have any suggestion, by the jigsaw
> or servlets.

Well, HTTP is stateless, it means that there is no notion of "session". Of
course, in the servlet API there is a way to do a session tracking, it
uses usually cookies or url rewriting (perfect for caches ;) ).
So you can't detect that someone closed its window unless the browser
enables you (via javascript or other things) to add a hook when the window
disappear. In that case, issue another HTTP request to the main server, to
notify the server the end of the session. Of course, if you want to be
bulletproof, use timeouts on the server side to avoid unset notifications,
like if the client reboot.
Regards,

      /\          - Yves Lafon - World Wide Web Consortium - 
  /\ /  \        Architecture Domain - Jigsaw Activity Leader
 /  \    \/\    
/    \   /  \   http://www.w3.org/People/Lafon - ylafon@w3.org    

Received on Tuesday, 27 October 1998 08:17:58 UTC