onUserCountChange issue + SFSRoom userCount wrong value

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

gPeart
Posts: 5
Joined: 28 Nov 2013, 10:57

onUserCountChange issue + SFSRoom userCount wrong value

Postby gPeart » 08 Jan 2014, 08:53

I'm using the version: 1.3.0 and the latest Server Version. Using Xcode 5.0.2/iOS 7.

Hey,

First of all, thank you for this amazing library and all excellent material and support!
I'm getting familiar with the API and trying to implement a simple logic.
1) Create a lobby with 5 rooms (flag game = true) using the same group 'games'
2) Each group has the maximum capacity of 2 users
3) When I connect and run this code on the onLogin:(SFSEvent *)evt event handler method:
[smartFox send:[SubscribeRoomGroupRequest requestWithGroupId:@"games"]];
I'm able to get informations about all rooms, using:
SFSRoom * roomDetails = [[smartFox.roomManager getRoomListFromGroup:@"games"] objectAtIndex:i]; //where 'i' is my index. At this point, everything is okay, I get all room names, maxUsers and userCount.

4) When I have new users connection and join rooms, the onUserCountChange is never fired, and the userCount isn't updated as well. Only if I connect a room, so, I'll get an updated information about that room in question

Am I doing something wrong? Based on the documentation, I should be able to get all details about all rooms since I'm Subscribed to the correspondent group. Also, the onUserCountChange event should be fired, so, I'll be update to update my list.

Thank you again and any help will be very welcome!
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: onUserCountChange issue + SFSRoom userCount wrong value

Postby Lapo » 08 Jan 2014, 10:57

Hi,
that's correct. Can you double check from the AdminTool that the Rooms in the "games" group are enabled for the USER_COUNT_CHANGE event?
http://docs2x.smartfoxserver.com/Gettin ... oneMonitor

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
gPeart
Posts: 5
Joined: 28 Nov 2013, 10:57

Re: onUserCountChange issue + SFSRoom userCount wrong value

Postby gPeart » 08 Jan 2014, 11:20

Hey, thank you for your feedback! Yes, it's enabled. Follow attachment. There is something else that I need to enable?
Attachments
Screen Shot 2014-01-08 at 11.48.48 AM.png
Room Configuration Settings + Permission and Events
(111.31 KiB) Not downloaded yet
Screen Shot 2014-01-08 at 11.39.35 AM.png
Monitoring room permissions and events
(47.54 KiB) Not downloaded yet
Screen Shot 2014-01-08 at 11.39.22 AM.png
Runtime room settings
(62.3 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: onUserCountChange issue + SFSRoom userCount wrong value

Postby Lapo » 08 Jan 2014, 15:58

Thanks for details.
I have tested your scenario and can't reproduce the issue. I have two groups: "default" and "games", I subscribe to "games" then from a Flash client a join various game Rooms inside that Room Group and I successfully receive the UserCountChange events on the iPhone simulator, with the correct details, user counts and such...

Are you sure you don't have errors on the server side? Maybe the client fails to subscribe to the group?
Lapo

--

gotoAndPlay()

...addicted to flash games
gPeart
Posts: 5
Joined: 28 Nov 2013, 10:57

Re: onUserCountChange issue + SFSRoom userCount wrong value

Postby gPeart » 08 Jan 2014, 16:24

Thanks for your feedback.
I got no error monitoring the [ISFSEvents onSubscribeRoomGroupError]. It's strange, because, if I comment this line, I cannot get the information when I load the application. So, this means, the user is subscribed to the 'games' group. Just cannot receive updated (users joining/leaving rooms of the same group).
I'll try to delete all rooms and start the flow again. Thank you so much!
gPeart
Posts: 5
Joined: 28 Nov 2013, 10:57

Re: onUserCountChange issue + SFSRoom userCount wrong value

Postby gPeart » 08 Jan 2014, 16:52

Hey Lapo, by the way, when I receive all details about the room (SFSRoom), userList, returns only information about users connected on the same room. Is that okay? or it's part of the same issue? Or should I get the name of each user connected on rooms part of the same subscribed group?
Thank you in advance
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: onUserCountChange issue + SFSRoom userCount wrong value

Postby Lapo » 08 Jan 2014, 17:36

Let me clarify a few points.
When you send a SubscribeRoomGroupRequest you will obtain an onSubscribeRoomGroup event. This will populate the client's local Room List with all the Rooms contained in that group and will keep updating them via UserCountChange events.

As regards the list of user inside each Room you won't be able to access them until you join any of those Rooms.

Hope it's clear.
Lapo

--

gotoAndPlay()

...addicted to flash games
gPeart
Posts: 5
Joined: 28 Nov 2013, 10:57

Re: onUserCountChange issue + SFSRoom userCount wrong value

Postby gPeart » 09 Jan 2014, 10:36

Hey, thank you!
Everything is okay now. I managed to get have the UserCountChange event been triggered properly.
About the list of users I understood your explanation and that's makes sense. I implemented my own solution for this specific case and works fine now.
Thank you again, for all help!
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: onUserCountChange issue + SFSRoom userCount wrong value

Postby Lapo » 09 Jan 2014, 11:33

Great, thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 15 guests