How many (and which) users are active on your (guarded) Nevow site? (Quicky recipe...)
Written by
on
in
Snaking.
Sat down and worked on a long-term wish-list feature, namely "presence" services for the Cinemon front-end. The first part of this is telling the user a) how many users are actively viewing the front-end, and b) which users they are. Well, we know we have this information stored in Nevow's guard.SessionWrapper object, it's just a matter of figuring out where we need to look to get at it.
All of this assumes that your entire site is guarded, if that's not true, then obviously you won't have all of your users in the guard's session wrapper.
The first thing to realise is that you'll need to store a reference to your root SessionWrapper somewhere. I store it in a property on the application object named ROOT_WEB_RESOURCE. With that, you can construct a method that returns the set of active users (with the amount of time since they were last active) like so:
Pingbacks
Pingbacks are closed.
Comments
Comments are closed.