opensourcer has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks how to display current online visitors list like we display in oursite(perlmonks) "Others Browsing the monastery: (25)" Thankyou opensourcer


"I really don't live on earth, it's just my reflection"
"open source is not only technology, but it's a world out there - opensourcer"

Replies are listed 'Best First'.
Re: current online visitors list
by Thilosophy (Curate) on Mar 07, 2005 at 06:24 UTC
    I dont know how the Monastry is doing this, but if I had to implement it I would keep a last-activity timestamp in my database for all user sessions, and if a session has seen activity (i.e.: loaded a page from my site) in the last, say, 5 minutes, I would declare this a "currently online visitor".
      That's just what perlmonks does. Since HTTP isn't stateful, all we can do is know when you last hit a link/node on the site (logged in, of course). The other users lists shows everyone who did that in the last 3 minutes, updating every 3 minutes, which is why sometimes you can be chatting away on the CB, and not show up.

      C.