simple handleRequest question

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
miguelportilla
Posts: 22
Joined: 27 Apr 2010, 11:22

simple handleRequest question

Post by miguelportilla »

Is it possible that the params 'command' or 'params' in handleRequest( String command, String[] params, User user, int roomId ) ever be null?

I know that in SFSX2 these could never be null but how about in SFS?

Thanks.
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

Not sure, but you should be able to test this yourself - for example,

smartFox.sendXtMessage("extName", null, null); (where the second and third parameters are command and params respectively).

and see how the server or client SFS API handles this.
Smartfox's forum is my daily newspaper.
miguelportilla
Posts: 22
Joined: 27 Apr 2010, 11:22

tried...

Post by miguelportilla »

Thanks for your suggestion, BigFIsh.

Here are my findings calling sendXtMessage ( specifying type string for the fourth param )..

If 'command' or 'params' is null, the client will crash. This happens because sendXtMessage tries to deference a null object.

So the answer to my questions seems to be that 'command' or 'params' can never be null on the server receiving end when using the raw string protocol. The client will crash and the message will simply never make it to the server.

The behavior isn't necessarily the same with other request handlers. For example I tested with the default ActionScript request handler and that allows a null 'params' which will equate to an empty object on the server side.
Post Reply