Groups are not working

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

imteractive
Posts: 20
Joined: 06 Jan 2012, 21:09

Groups are not working

Postby imteractive » 06 Jan 2012, 21:18

Hi all,

I'm trying to evaluate SFS2X to use on a large Facebook game we're going to develop. However I'm having some quite serious problems with groups which are essential for us.

I create a group (group1) using the Zone Configurator, save and restart the server. Everything is OK according to the console log:

Code: Select all

20:50:28,727 INFO  [main] managers.SFSZoneManager     - Creating room: (default) The Lobby
20:50:28,727 INFO  [main] api.SFSApi     - Room created: [ Room: The Lobby, Id: 3, Group: default, isGame: false ]
20:50:28,727 INFO  [main] managers.SFSZoneManager     - Creating room: (group1) GameRoom
20:50:28,728 INFO  [main] api.SFSApi     - Room created: [ Room: GameRoom, Id: 4, Group: group1, isGame: false ]
20:50:28,728 INFO  [main] managers.SFSZoneManager


But then when doing something like:

Code: Select all

public function get roomList() : Array
{
   return _smartFoxServer.getRoomListFromGroup("group1");
}


I get an empty array. I also get an error saying the group doesn't exist if I try to subscribe it.

Can someone please help?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 06 Jan 2012, 21:30

Hi.

You're trying to get the rooms of that group from the client correct? If so, please make sure that that groupId is in the Default Room Groups setting of that zone's configuration. Please remember that if the client isn't subscribed to that room group, it won't get any updates from it or and the room list.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
imteractive
Posts: 20
Joined: 06 Jan 2012, 21:09

Postby imteractive » 06 Jan 2012, 22:13

Thanks rjgtav,

That solved the problem!

BTW, I noticed that the IRoomManager info on http://docs2x.smartfoxserver.com/api-docs/asdoc/ is not updated with all methods. Do you know if there's a place with a more up-to-date API docs?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 06 Jan 2012, 22:52

Well, those are the most updated docs... What methods are you referring to that are not in there?
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
imteractive
Posts: 20
Joined: 06 Jan 2012, 21:09

Postby imteractive » 07 Jan 2012, 12:22

Take for example IRoomManager. This is what I have on my SWC:

Code: Select all

public interface IRoomManager
   {
      public function addGroup(groupId : String) : void;

      public function addRoom(room : Room, addGroupIfMissing : Boolean = true) : void;

      public function changeRoomCapacity(room : Room, maxUsers : int, maxSpect : int) : void;

      public function changeRoomName(room : Room, newName : String) : void;

      public function changeRoomPasswordState(room : Room, isPassProtected : Boolean) : void;

      public function containsGroup(groupId : String) : Boolean;

      public function containsRoom(idOrName : *) : Boolean;

      public function containsRoomInGroup(idOrName : *, groupId : String) : Boolean;

      public function getJoinedRooms() : Array;

      public function getRoomById(id : int) : Room;

      public function getRoomByName(name : String) : Room;

      public function getRoomCount() : int;

      public function getRoomGroups() : Array;

      public function getRoomList() : Array;

      public function getRoomListFromGroup(groupId : String) : Array;

      public function getUserRooms(user : User) : Array;

      public function get ownerZone() : String;

      public function removeGroup(groupId : String) : void;

      public function removeRoom(room : Room) : void;

      public function removeRoomById(id : int) : void;

      public function removeRoomByName(name : String) : void;

      public function removeUser(user : User) : void;

      public function replaceRoom(room : Room, addToGroupIfMissing : Boolean = true) : Room;

      public function get smartFox() : SmartFox;
   }


On the docs only has 11 of those methods.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 08 Jan 2012, 17:47

The other methods you're referring to that aren't documented are methods that aren't to be used by us (developers), they're used by the API in order to work properly. Please use just the methods that are documented.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
imteractive
Posts: 20
Joined: 06 Jan 2012, 21:09

Postby imteractive » 09 Jan 2012, 12:34

Oh OK! Didn't know that.

Thanks for the information! ;)

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 52 guests