I'm trying to implement a member list for a chat application. The
member list is implemented as a comet actor which receives message
when users visit and leave the chat page.
Currently I detect when a user visits the page by executing a js
function called "joinChat" near the bottom of the page. When
executed, "joinChat" calls (via ajaxInvoke) a scala method that
notifies a list of comet actors that a new visitor has arrived. This
works great.
Unfortunately, I'm having trouble detecting when users leave the chat
page. I've tried using the window.onbeforeunload method, but there is
an outstanding bug in chrome
(http://code.google.com/p/chromium/issues/detail?id=11666) and Opera
which prevent ajax calls from being sent in onbeforeunload.
I've also tried setting the comet actor's lifespan to 5 seconds, but
that seems to destroy comet actors once they've been idle for 5
seconds.
Are there any other mechanisms in lift that could help me solve this
problem. Perhaps, there is some way to hook into the "keepAlive"
signal that lift uses for comet actors? Or maybe there's a setting
that makes lift destroy comet actors as soon as they don't appear on a
page?
Thanks,
Xavi
Or maybe there's a setting
that makes lift destroy comet actors as soon as they don't appear on a
page?
Thanks,
Xavi