On 09 Nov 2009, at 16:35, Colin Law wrote:

>> Well, most of it is actullay not any data that's going to be saved in
>> the database. I need to know various numbers like "current number of
>> users", "maximum number of users", "ids of the users" and stuff like
>> that.
>>
>> So I guess I should go for the session?
>
> What do you mean by "current number of users"?  Do you mean how many
> users are logged on?  I got the impression in your original post that
> we were talking about data entered by the user.  How do you know how
> many users are currently logged on?  Remember that a session is on a
> user by user basis.  If you want to remember data across users I think
> you will have to put it in the db.

Indeed, with the ActiveRecord store, you could count the number of  
sessions that were active in the last x minutes, but even that's just  
an approximate value. With the CookieStore, you don't have a way to  
determine the number of active users that easily (which certainly  
doesn't mean you have to use the ActiveRecordStore again).

The only reliable way is maintaining a persistent connection to the  
server (using Juggernaut or Comet for example). When that connection  
is terminated, the user has logged off (it will even provide instant  
feedback when the window is closed, but the session is still  
persisting in the user's browser).


Best regards

Peter De Berdt


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to