Page 1 of 1

getRoomList() doesn't work for me

Posted: 02 Jan 2007, 19:23
by Carl
According to the documentation,


"Fires the onRoomListUpdate event"

I put a tracer on onRoomListUpdate, and put a trace on the function that is calling "smartFox.getRoomList()". The roomlistUpdate triggers when the program first runs, and my functions traces that it's sending the command but no triggering happens and I don't get my new room list from the server.

Posted: 02 Jan 2007, 21:03
by Lapo
it seems you're not getting the very simple sequence of that is necessary to follow in order to start interacting with the server and other users.

It just takes 3 simple steps:

1- establish a connection
2- login into a Zone
3- join a Room

All this is clearly explained in chapter 5.a of our docs together with a code template. All you need to do to make it work is just to copy and paste it in the 1st frame of a new Flash document :)

Side note: the getRoomList() is called for you by the API when you successfully log in. Unless you are you're implementing a custom server login you won't even need to call it.

Let us know if something is not clear.

I did that

Posted: 02 Jan 2007, 22:58
by Carl
I did those things.

Sorry for the frustration I expressed in the last post; I didn't mean to be rude and I appreciate the help.

I do understand the basic concepts of multiuser stuff because I did a pretty decent chatroom and multiuser pictionary game before, similar to your theo chat; the problem is rather that I have trouble getting commands to work, functions to trigger, and objects to extract information properly. i can't only use example code because the final product I've been tasked to build by my boss is more complicated.


1. I DID established a connection
2. I loggeed in
3. I joined a room automatically using the autojoin feature.

All these things I believe are working because I'm able to send a chat message to my other client quite perfectly, and it does all the user joined alerts as they should.

The trouble is, as I said, that after doing the above 3 steps the "smartFox.getRoomList()" command doesn't trigger the "onRoomListUpdate" on either the client that's sending the message or the client intended to receieve it.


Also, I started trying to use the "sendObject()" command such that the "onObjectReceived" would be triggered on another client but that doesn't work either, so there may indeed be something very basic that's wrong with my code, but I'm definately logged in and connected to a zone.

here's the code for that, maybe I'm not building the object correctly, so it just doesn't go through because it's not formatted properly? I didn't use the {} example method of creating an object that I got from the documantation because copying it straight in gave me a syntax error.

function sendObject() {
var ToSend:Object = new Object();
ToSend.px = 150; = 250;
trace("Sending Object");
// Recieve object from server
smartFox.onObjectReceived = function(obj:Object, sender:User)
trace("Got data from: " + sender.getName())
trace("X = " + obj.px + ", Y = " +

Posted: 03 Jan 2007, 07:11
by Lapo
but I'm definately logged in and connected to a zone.

did you join a room?

In order to make sure that your code flow is correct please do check the example provided in chapter 5.a, it's a simple code template that connects to a room.

Another big recommendation I can suggest is to keep all your code in one frame, and avoid putting pieces of code all over the places like on movieclip instances or multiple frames.
This will help a lot with debugging and it will avoid many well known Flash pitfalls, like the "wait-one-frame" syndrome and the loss of scope.

If you want to check an advanced SFS app, have a look at the SmartMessenger example and at its source code.

One more thing (maybe it's obvious): the sendObject() method does not send back the object to the sender itself.

hope it helps


Posted: 03 Jan 2007, 16:02
by Carl
I will recheck that I've joined a room, but if my two clients can chat to each other, doesn't that mean that they're both logged into the same room?

Yea, I put all the code on one frame mostly because I don't like jumping around from script to script, which I find ciumersome in Flash; if a button needs to do something I have it call a function rather than do anythign on that MC.

I did suspect that a client would not have this message sent back to itself, so I've been trying with two clients...

Anyway, there's a bunch of stuff for me to check given my knack for making typos!


Posted: 30 Aug 2011, 09:54
by srirangr

I'm stuck on the same problem. I'm using a custom login but I'm unable to get a roomList even after asking for one. I've been facing this problem for the last few days. If you've found out the solution, can you let me know of this on my email: or in this forum :D ?

Thank you.
Srirang Ranjalkar

Posted: 30 Aug 2011, 23:12
by BigFIsh

Have you connected and logged into the server prior to calling getRoomList() ?

Furthermore, ensure that you don't have roomList listed under <DisabledSysActions>

Have you checked the output/input messages (to/from) SFS server? You'll need to turn on the .debug flag for your SmartFoxClient instance.

Posted: 30 Aug 2011, 23:36
by srirangr
Dear BigFish,

I'm connected to the server. I'm developing a turn based game app on Android. Since I'm using a custom login, I'm able to get the RandomKey as well. Also, I've turned the debug mode on and I'm getting the [Sending] message too, but I'm not receiving any [ RECEIVED ] message. That is exactly where I'm stuck.

Thanks for your reply.
Srirang Ranjalkar.

Posted: 30 Aug 2011, 23:41
by BigFIsh
Are you able to provide us all [Send] and [Received] messages to/from the server up to the point where nothing happens?

Additionally, have you checked your server logs for any warning/errors?

Posted: 31 Aug 2011, 00:53
by srirangr

The following are the Send, Received messages that I get until I stop getting any of those messages:

08-31 07:26:25.692: INFO/SmartFoxClient(591): [Sending]: <msg t ='sys'><body action='verChk' r='0'><ver v='158' /></body></msg>

08-31 07:26:25.761: INFO/SmartFoxClient(591): [ RECEIVED ]: <cross-domain-policy><allow-access-from domain='*' to-ports='443' /></cross-domain-policy>, (len: 90)

08-31 07:26:26.312: INFO/SmartFoxClient(591): [ RECEIVED ]: <msg t='sys'><body action='apiOK' r='0'></body></msg>, (len: 53)

08-31 07:26:28.542: INFO/SmartFoxClient(591): [Sending]: <msg t ='sys'><body action='rndK' r='-1'></body></msg>

08-31 07:26:28.872: INFO/SmartFoxClient(591): [ RECEIVED ]: <msg t='sys'><body action='rndK' r='-1'><k>zOnnbQYCRwNJtkg</k></body></msg>, (len: 75)

08-31 07:26:30.972: INFO/SmartFoxClient(591): [Sending]: <msg t ='sys'><body action='login' r='0'><login z='zenfox'><nick><![CDATA[randomname|2|Indian_Rummy]]></nick><pword><![CDATA[bbcefd91455d4b69047a5e7f936cad2d]]></pword></login></body></msg>

08-31 07:26:31.582: INFO/SmartFoxClient(591): [ RECEIVED ]: {"t":"xt","b":{"r":-1,"o":{"id":21938,"playerId":"","name":"randomname|2|Indian_Rummy","_cmd":"logOK","user":""}}}, (len: 218)

08-31 07:26:31.602: INFO/SmartFoxClient(591): [Sending]: <msg t ='sys'><body action='getRmList' r='-1'></body></msg>

Thank you.
Srirang Ranjalkar

Posted: 31 Aug 2011, 01:05
by BigFIsh
Those messages looks valid to me.

Double check your customLogin internal event logic. Are you logging the user correctly into the zone using _server.loginUser() and that you are checking if the login was successful?


var obj = _server.loginUser(nick, pass, chan);

That's the only other thing I can think of.

Posted: 08 Sep 2011, 12:41
by srirangr
Hi BigFish,

I'm using two types of clients here. One is Flash and the other is Android. On the flash client, I'm getting the roomList properly which means that my CustomLogin internal event logic is working fine. On the Android client I'm getting the roomList in the form of XML (and not JSON, which is expected), but the onRoomListUpdate event is not being fired.

Also, whenever I restart the server, I'm getting the roomList on Android twice when I call the getRoomList method and the onRoomListUpdate event is also getting fired twice. But then, I have to restart the server again and again to get the roomList which is affecting my Flash client.

Can you help me out in this case please?

Thank you,
Srirang Ranjalkar.