[Lift] Re: User Presence Heartbeat
We can make fixes to the 1.0.x branch for you, but I am reluctant to make changes to the 1.0 version. Very understandable. We'll just bump up to the 1.0.2 release. That jump has been on the back burner for a while, so it's good to get an excuse to push it through. :-) You might look into having your session management system let Lift know that the session is going down. Lift *should* be tied to the container's session and if it's not working, please get us a repro case and we'll fix it. Looking into it now. It's also possible that Spring Security isn't killing off the session properly, in which case Lift is more than justified in hanging onto whatever information it has left. If it turns out that the session is dying but Lift still isn't firing Unlisten on its own, then I'll do what I can to get you a reproducible test case. Time is a little tight right now though, so I may not be able to do much more than report the bug in a case-less state. Is this an issue that needs to be solved this week? If not, I'll have more time next week and can putter around with Jetty and see what I can learn about what it does with comet, NIO, etc. and see if there's a better way to give you what you need. The sooner the better, but we understand that you have other things to do. We're going to forge ahead with the Listen/Unlisten trick coupled with some extra hooks in Spring Security working under the assumption that we'll be able to make it solid enough for now. If and when you find a better way to do this, we'll switch to that technique moving forward. So in other words, feel free to putter as soon as you get the chance! We would certainly appreciate anything you can come up with. Daniel -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: User Presence Heartbeat
If you're using ProtoUser you can override the relevant method so that when the user logs out you can take some action. - Daniel Spiewakdjspie...@gmail.com wrote: 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 feeder.of.the.be...@gmail.com 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 djspie...@gmail.comwrote: 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 naftoli...@gmail.com wrote: You are already using Comet, or just Lift? - Daniel Spiewakdjspie...@gmail.com 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: User Presence Heartbeat
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 feeder.of.the.be...@gmail.com 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 djspie...@gmail.comwrote: 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 naftoli...@gmail.com wrote: You are already using Comet, or just Lift? - Daniel Spiewakdjspie...@gmail.com 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: User Presence Heartbeat
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 naftoli...@gmail.com wrote: You are already using Comet, or just Lift? - Daniel Spiewakdjspie...@gmail.com 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: User Presence Heartbeat
Whilst, I dont have an answer just yet, I wanted to say that the below statement is very, very cool! Cheers, Tim On 12 Jan 2010, at 18:25, Daniel Spiewak 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. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: User Presence Heartbeat
Tim, ask him if he's using ScalaQuery with Lift! - Timothy Perretttimo...@getintheloop.eu wrote: Whilst, I dont have an answer just yet, I wanted to say that the below statement is very, very cool! Cheers, Tim On 12 Jan 2010, at 18:25, Daniel Spiewak 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. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: User Presence Heartbeat
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 djspie...@gmail.comwrote: 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 naftoli...@gmail.com wrote: You are already using Comet, or just Lift? - Daniel Spiewakdjspie...@gmail.com 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: User Presence Heartbeat
Sweet, that looks like exactly what I need! I'll post back here if that doesn't work properly. Daniel On Jan 12, 12:46 pm, David Pollak feeder.of.the.be...@gmail.com 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 djspie...@gmail.comwrote: 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 naftoli...@gmail.com wrote: You are already using Comet, or just Lift? - Daniel Spiewakdjspie...@gmail.com 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.