[Kss-devel] A live chat module...

Balazs Ree ree at ree.hu
Thu Oct 18 08:52:49 CEST 2007


On Tue, 16 Oct 2007 16:15:37 +0300, George Gozadinos wrote:

> Hi,
> I started working on an open source live chat product for plone3. There
> is a working prototype ready, however I would like to report the
> following seeking for some advice...
> 
> 1) While I can set a document:load on my kss there seems to be no
> document:unload. That would be good to have for this use case as I would
> like to know when a user leaves the chat room... Now I periodically try
> to see if there was no user ping for a while to detect quitters, which
> is not so nice...

There is one browser event (window.onbeforeunload) that could be 
implemented as document:unload (or, as a matter of fact, as 
document:beforeunload). This can even be done as a few lines plugin.

However there is no guarantee that it will be called. The client can just 
"go away". So you need to periodically check the presence of your clients 
anyway, in a chat application, or you may end up with clients stuck for 
infinity.

-- 
Balazs Ree



More information about the Kss-devel mailing list