Page 1 of 1

SFSEvent.USER_COUNT_CHANGE is not firing

Posted: 24 Aug 2011, 07:28
by levancho

I am trying to figure out why SFSEvent.USER_COUNT_CHANGE is not firing when I join the room from Serverside, I have not tried to rewrite the code to join the room from client side yet but its definately not working when I join the room from server side.

I have Lobby room (non game type room) that has all permissions and events selected, and what I do is as soon as user joins the zone, I am manually joining that user into the zone from Server side.

Code: Select all

getApi().joinRoom(theUser, lobby);

in admin under room monitor it shows correct number of users joineed.

but I am not getting SFSEvent.USER_COUNT_CHANGE on the client side
the only event I am getting is USER_JOIN and USER_ENTER events.

I tried with two clients (both local but different usernames ) I am not sure if that is related .

do I have to join the room from client side for USER_COUNT_CHANGE that event to fire? if so
what other option do I have to know whenever user count changes?

I am using SF2 RC3.

any suggestion would be appreciated.
Kind Regards

Posted: 24 Aug 2011, 07:41
by rjgtav
Hi. If I remember correctly, the USER_COUNT_CHANGE event is only fired at the room-level, so you need a room-level extension to listen to that event.

Yes, confirmed, and thats why this event is inside the SFSRoomEvents class.

Posted: 24 Aug 2011, 07:44
by levancho
[Solved] might be a bug.

apparently problem is with group subscriptions vs joined room here is what happened.

I modified (under zone config) default groups list and removed group that lobby belonged to from that list, now even if I joined lobby group I was no longer receiving USER_COUNT_CHANGE events for lobby
should not client have still received USER_COUNT_CHANGE because It was in that room ?

Posted: 24 Aug 2011, 07:47
by rjgtav
Oh, i see, sorry i thought you were talking about the server-side USER_COUNT_CHANGE event. In the client-side, yes you need to subscribe to the room group where the room you want to listen to is.

Hum... I don't know if thats a bug or if was intended to work like that. In SFS2x, for better control of the events, you need to register to the correct room groups

Re: SFSEvent.USER_COUNT_CHANGE is not firing

Posted: 16 Nov 2012, 20:12
by levancho
bringing back this issue

basically: here is whats happening.

I have joined lobby room,
then I joined room1
and after room1 I have subscribed to ouser count change event, but I am not receving events actually i am not receving any events for that room1
I am listening to
spectator to player
player to spectator
and user count
non of them arrive even if I am in that room current, so my question is
do I need to explicitly subscribe for the group that room1 belongs to, in order to receive its events, even if I am inside that room?

it kind of says in documentation that if you are in the room you will receive its events without subscribing to the group it belongs to,
any ideas why its happening?

here is the quiote from docs:
The User could even avoid to subscribe to any Group at all and still be able to join any Room in the Zone, although he won't receive any updates from Rooms that are not joined.