Skip to content

Simple somegroup.count #176

Closed
andrecaribe opened this Issue Jan 26, 2012 · 5 comments

3 participants

@andrecaribe

Simple everyone.count or somegroup.count to get the number of users at the time dont exist anymore?
I need to limit the number of users in a room. Which path should I follow?

@ericz
ericz commented Jan 26, 2012

Hi andrecaribe,

somegroup.count should still exist? What is the issue you are experiencing?

@ericz
ericz commented Jan 26, 2012
 everyone.count(function(count){
      console.log(count);
 });

Note that .count is now an asynchronous function

@andrecaribe

@ericz, you write here #49 (comment)

I would like to access the value in a synchronous manner. Any way, I could do what he wanted, with more work, but it was done. Thanks!

@steveWang

You can technically access it in a synchronous manner; it just won't be compatible with the cluster version, since there's really no way to access a group's count synchronously without blocking when users are potentially spread across multiple servers. Try Object.keys(group.users).length. Not advised.

@ericz
ericz commented Jan 27, 2012

@andrecaribe steveWang's method will work if you need synchronous access but is not documented.

Good luck!
Eric

@ericz ericz closed this Jan 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.