user_count_change event problem

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

Post Reply
itsmylifesoham
Posts: 186
Joined: 16 Oct 2011, 14:33

user_count_change event problem

Post by itsmylifesoham »

hi,

i noticed a very peculiar behaviour.

Earlier i was maintaining an onlineuserlist by listening to the user_enter and user_exit events in the lobbyroom.

so lets say Mr.A is in the lobbyroom he would be listening for user_enter, user_exit. so when Mr.B comes in then A's onlineuserlist will display A,B.

i heard that enabling these two events is bandwidth intensive if lots of users come in the lobbyroom and leave it very frequently. so i disables these two events in the roompermissions&events in admin tool for the lobby room. now only user_count_change event is enabled. and now Mr.A listens only to user_count change. the funny behaviour now :

1. Mr. B enters the lobby room. MrA is getting the user_count_change event saying uc:2 but i am seeing that the

Code: Select all

(event.params.room as sfsroom).userlist
for the user_count_change event contains only Mr.A ! why not Mr.B also since uc = 2 ?

2. Now i saw this problem and went serverside and enabled user_enter user_exit along with user_count_change.
on client side still listening only to user_count_change. This time when Mr.B joined, Mr.A got the user_count_change event, and the

Code: Select all

(event.params.room as sfsroom).userlist
was containing both Mr.A and Mr.B which is what i wanted!

the Q is does user_count_change event require user_enter and user_exit to be fired? if so where is the bandwidth saving?

any ideas? :D

thanks.
itsmylifesoham
Posts: 186
Joined: 16 Oct 2011, 14:33

Re: user_count_change event problem

Post by itsmylifesoham »

hi again,

i was trying to think to myself why this user_count_change event was made. and i think i might have been wrong in
thinking it as a more efficient replacement for user_enter and user_exit events. I think it was designed more for just notifying the number of users and changes in that number when you are not joined into that room.

So i am gonna quit using that event and stick with good old user_enter and user_exit events, and user the user_count_change where it is designed to be used :) hope that might help someone who is confused when to use user_count_change event and is trying to access the userlist in the event.params.room that comes with a user_count_change event.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: user_count_change event problem

Post by Bax »

That's it! :D
Paolo Bax
The SmartFoxServer Team
Post Reply