This seems to work very nicely. Well, it gives me lots of spurious events, but a little bit of filtering based on active ListenerId(s) and I'm golden. Unfortunately, I've already run into two main problems:
* It seems to be somewhat non-deterministic as to whether or not every listener is closed when the browser is shut down (Firefox 3.6). It's possible that just one listener is remaining active (hasn't been Unlisten'ed), which would prevent my presence system from firing. Is this to be expected? Do I just need to wait a little longer for the connection to time out? * The Unlisten event does not *ever* seem to fire when the user logs out. The logout action redirects the user back to the login page, which obviously wouldn't have a long-poll. Nevertheless, my system still thinks the logged-out user is active. It's possible that I'm filtering something or perhaps associating the event wrong; it would depend on whether session var changes propagate prior to the Unlisten event. Any ideas here? Daniel On Jan 12, 12:46 pm, David Pollak <[email protected]> wrote: > I'm kind swamped today, but the simplest thing you can do is: > > private def notifyListen = { > MyUserThingy.gotAListenEventFor(User.currentUser) > false > > } > > private def notifyUnlisten = { > MyUserThingy.gotAnUnlistenEventFor(User.currentUser) > false > > } > > override def highPriority = { > case Listen(_, _, _) if notifyListen => () > case Unlisten(_) if notifyUnlisten => () > > } > > Each time the browser registers as a listener, you'll get a notification > (the beginning of the long poll). Each time the browser unregisters as a > listener (the end of the long poll), you'll get a notification. > > This stuff is kinda internal and may change (although there's no plans to > change the Listen/Unlisten logic). > > On Tue, Jan 12, 2010 at 10:25 AM, Daniel Spiewak <[email protected]>wrote: > > > > > We're already using the Comet support within Lift quite extensively > > across the board. There are very, very few pages in our application > > which do not have a CometActor embedded in them at some level of > > nesting. > > > Daniel > > > On Jan 12, 12:08 pm, Naftoli Gugenheim <[email protected]> wrote: > > > You are already using Comet, or just Lift? > > > > ------------------------------------- > > > > Daniel Spiewak<[email protected]> wrote: > > > > I'm looking to implement a user presence feature (think: Facebook or > > > Gmail chat) in a Lift 1.0 application. Ideally, I would like to avoid > > > adding extraneous connections. Is it possible to hook into the Lift > > > Comet heartbeat which is already in use across our system? I've > > > looked at the source for CometActor, and it's just a little too > > > obfuscated for me to figure this one out on my own. :-) > > > > Alternatively, has anyone else implemented this sort of system in > > > Lift? If so, how did you go about it? Any tips from the well- > > > informed? > > > > Daniel > > > -- > > > You received this message because you are subscribed to the Google Groups > > "Lift" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > [email protected]<liftweb%[email protected]> > > . > > > For more options, visit this group athttp:// > > groups.google.com/group/liftweb?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Lift" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<liftweb%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/liftweb?hl=en. > > -- > Lift, the simply functional web frameworkhttp://liftweb.net > Beginning Scalahttp://www.apress.com/book/view/1430219890 > Follow me:http://twitter.com/dpp > Surf the harmonics -- You received this message because you are subscribed to the Google Groups "Lift" 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/liftweb?hl=en.
