null RoomId on CreateRoom

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

drpeck
Posts: 11
Joined: 18 Apr 2007, 14:14

null RoomId on CreateRoom

Postby drpeck » 18 Apr 2007, 15:06

I'm confused.

The AS 2.0 API Docs say for CreateRoom:
The roomId parameter is optional and only needed for advanced tasks, when using multiple room at the same time.


But I'm getting the following debug output
[Sending]: <msg t='sys'><body action='createRoom' r='null'><room upd='0' tmp='1' gam='1' spec='1' exit='1'><name><![CDATA[game1]]></name><pwd><![CDATA[undefined]]></pwd><max>50</max><uCnt>0</uCnt><vars><var n='Complexity' t='n' pr='1' pe='1'><![CDATA[3]]></var></vars></room></body></msg>


and the following logged error in the admin tool:
2007/04/18 16:09:52.071 - [ WARNING ] [id: 11] (SystemHandler.processEvent): SysHandler -> Bad room id. Action: createRoom >> java.lang.NumberFormatException: For input string: "null"


I've looked at the SmartFoxClient and found the following:

Code: Select all

   public function createRoom(roomObj:Object, rId:Number)
   {
      var roomId:Number   = (rId == undefined) ? this.activeRoomId : rId
               //The rest of the function has been left out for readibilty



This is setting roomId to null as I haven't joined a room yet so my activeRoomId is null. What am I to do? Create my own index of Room Ids?

Any help, please?

David
User avatar
Lapo
Site Admin
Posts: 21368
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 19 Apr 2007, 16:49

Hi David,
the problem is that you can't request the creation of a room if you're not already connected inside a room.

If the room must be created before the user goes anywhere then you should do it from the server side.
There are important security aspects behind this, you can learn more from here
Lapo
--
gotoAndPlay()
...addicted to flash games
drpeck
Posts: 11
Joined: 18 Apr 2007, 14:14

Clarity

Postby drpeck » 20 Apr 2007, 07:30

:o Cheers Lapo. That makes sense.
User avatar
Lapo
Site Admin
Posts: 21368
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 20 Apr 2007, 09:10

I am moving this message in the right section as this is not a bug :)
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 19 guests