RoomList shows always ZERO

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

Moderators: Lapo, Bax

jamalsoueidan
Posts: 153
Joined: 15 Aug 2011, 16:33

RoomList shows always ZERO

Post by jamalsoueidan »

Hello,

It's weird when I look in the ZoneMonitor I can see something like this.

Lobby(1)
test(2)

But when I go through the roomList in the AS3 client, I get:

0 0 3
0 0 0

Code: Select all

for each(var r:Room in _server.roomManager.getRoomList() ) {
    trace(r.playerList.length, room.userList.length, room.userCount);
}
The one in the ZoneMonitor is correct, but I cannot get the same result :S
jamalsoueidan
Posts: 153
Joined: 15 Aug 2011, 16:33

Post by jamalsoueidan »

I have tried almost everything :S

_server.getRoomByName("random").addUser(_server.mySelf);

Then my event listener get dispatched and go through roomList but still the old counts :S

I'm either doing something wrong or their is some errors.

I tried also at the server-side, but it doesn't work either.

Code: Select all

newRoom.addUser(userInvitee);
			
lastRoom.removeUser(userInviter);
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

Hi. To join an user from the server-side, please use the joinRoom() method of the SFSAPI class:

http://docs2x.smartfoxserver.com/api-do ... l#joinRoom(com.smartfoxserver.v2.entities.User, com.smartfoxserver.v2.entities.Room)
jamalsoueidan wrote:_server.getRoomByName("random").addUser(_server.mySelf);
And, from where did you get this line?
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.
jamalsoueidan
Posts: 153
Joined: 15 Aug 2011, 16:33

Post by jamalsoueidan »

Thanks for your answer.

My Serverside-Extension Code.

Code: Select all

Room newRoom = getApi().createRoom(extension.getParentZone(), setting, userInviter, false, null, true, false);

getApi().joinRoom(userInviter, newRoom);
getApi().joinRoom(userInvitee, newRoom);

getApi().leaveRoom(userInviter, extension.getParentRoom());
getApi().leaveRoom(userInvitee, extension.getParentRoom());
In my ClientSide Code.

Code: Select all

...
	_server.addEventListener(SFSEvent.ROOM_ADD, roomAdded);
	_server.addEventListener(SFSEvent.ROOM_JOIN, roomAdded);
}

protected function roomAdded(event:SFSEvent=null):void
{
	for each( var room:Room in _server.roomList ) {
		trace(room.name, room.userCount);
	}
}
Before extension call:
Lobby 3
oxziic 0

After extension call:
Lobby 3
oxziic 0

Admin Zone Monitor:
Lobby 1
oxziic 2

getRoomByName is from server-extension.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

Hum... Please make sure you have the latest SFS installed on your computer (RC3)
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.
jamalsoueidan
Posts: 153
Joined: 15 Aug 2011, 16:33

Post by jamalsoueidan »

I have the newest RC3 :)

Their is small bugs here and there...

Now the rooms never get removed, I don't know if you have a timer on that?

setting.setAutoRemoveMode(SFSRoomRemoveMode.WHEN_EMPTY);

and all the rooms have been empty for long time now...

I have to restart the server to delete the rooms.

But this again another issue...
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

Sorry my laptop fried and i dont have sfs installed on this one, so i can't test this. But i'm pretty sure this was working before. Just a note, call the joinRoom and leaveRoom only once. maybe thats whats bugging the server
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.
jamalsoueidan
Posts: 153
Joined: 15 Aug 2011, 16:33

Post by jamalsoueidan »

I used another method :)

Thanks for your help.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

hi. Can you say what method you used? Just for future reference
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.
jamalsoueidan
Posts: 153
Joined: 15 Aug 2011, 16:33

Post by jamalsoueidan »

1. Request Create new Room
2. Dispatch extension response
3. User disconnect and connect to new room.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

hi. Just one thing i remembered today. Have you disabled the server side events such as ROOM_ADD and USER_ENTER_ROOM, etc?
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.
jamalsoueidan
Posts: 153
Joined: 15 Aug 2011, 16:33

Post by jamalsoueidan »

Nope why should I disable them?

You can follow this topic or maybe you can help me :D

http://forums.smartfoxserver.com/viewtopic.php?t=12020

This a new bug...it feels like battling with your eyes closed against smartfoxserver. Everything needs to be done in one way, but nobody knows how only the developers behind the server.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

Well, i asked that because if you disable those events, the client desynchronizes. Could you please turn on the debug flag on the client and please check if you get the proper events? I'll try to test these bugs here
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.
jamalsoueidan
Posts: 153
Joined: 15 Aug 2011, 16:33

Post by jamalsoueidan »

if you have skype, you are welcome to add me my friend :)

jamalsoueidan

then we can test it faster and see if their is a bug in smartfoxserver.
jamalsoueidan
Posts: 153
Joined: 15 Aug 2011, 16:33

Post by jamalsoueidan »

I cannot see any of these events dispatched to the other room in other group.

lobby (group default)
testing (group game)

the lobby only gets the custom extension response (newGameStarted) but not the events you talking about.

I'm doing the join server-side.

getApi().joinRoom(user, room, null, false, null, true, true);

At the user entering zone level.

addEventHandler(SFSEventType.USER_JOIN_ZONE, UserZoneJoinEventHandler.class);
Post Reply