Page 1 of 1

Error handling while calling _server.joinRoom()

Posted: 11 Nov 2009, 06:43
by Rohit Sharma
Hi,

In my application, the join room procedure consists of sending a add_user message to server and then, after few checks I call _server.joinroom().

i) The AS1 api says that the result of _server.joinroom() is a boolean.
If the process fails and the boolean result is false, will the client get an
onJoinRoomError event or I have to explicitly send the message?
ii) What if an exception occurs when _server.joinroom() is called? I saw
that inside MainLib.as if a true/false value comes, the result is sent but
no result if an exception comes and is caught. Is it possible to catch the
exception inside AS code?

The reason for me asking this is that sometimes the client hangs after I send the add_user request. Although, I am handling the onJoinRoomError event but nothing happens when it hangs.

Thanks,
Rohit

Posted: 15 Nov 2009, 08:51
by Rohit Sharma
Hello all,

Please provide some clue to the above mentioned issue.

Thanks,

Posted: 18 Nov 2009, 20:29
by Lapo
Sorry for the delay.
i) The AS1 api says that the result of _server.joinroom() is a boolean.
If the process fails and the boolean result is false, will the client get an
onJoinRoomError event or I have to explicitly send the message?
Yes, this is correct. Error messages are returned to the client just like when the request is sent from client side.
ii) What if an exception occurs when _server.joinroom() is called? I saw
that inside MainLib.as if a true/false value comes, the result is sent but
no result if an exception comes and is caught. Is it possible to catch the
exception inside AS code?
_server.joinRoom does not fire any exceptions.
If the result is false, you will probably need to log the error. At least this will help you finding the possible cause.
Actually the only cause I can think of for a failure is a name collision, in other words when you try to create a Room with a name that already exists.