List Info

Thread: Problems with Parameters of calls (call() from Flash)




Problems with Parameters of calls (call() from Flash)
user name
2006-06-21 18:58:30
If I call a method on Red5...

Model.simpleConnect.callServer("changeUserStatus", [id, status]);

and then have a Red5 Handler:

public void changeUserStatus(Object[] params){}


When the handler is called, I get a argument with two items. The first item in params is a org.red5.server.net.rtmp.RTMPMinaConnection

Am I supposed to mark that as my connection?
IConnection conn = params[0];
(yes, I know that won't work as is)


And what about params[1]? It's coming across as a HashMap (is someone obsessed? -- but what I am sending is one string and one number. When I look at it, the number has been converted to a String, so I have to convert it again... (untested code):

HashMap p = (HashMap)params[1];
Set keys = p.keySet();
Object[] keyObjects = keys.toArray();
Object one = keyObjects[0];
String id = (String)p.get(one);
Object two = keyObjects[0];
String statusString = (String)p.get(two);
Integer status = Integer.valueOf(statusString);

Am I doing this all wrong?
Am I getting the proper items through the handler?
Am I handling the params[1] items correctly? Efficiently?

Leif


Problems with Parameters of calls (call() from Flash)
user name
2006-06-21 19:11:13
Hi Leif,

Leif Wells wrote:
> If I call a method on Red5...
> 
>
Model.simpleConnect.callServer("changeUserStatus"
;, [id, status]);
> 
> and then have a Red5 Handler:
> 
> public void changeUserStatus(Object[] params){}
[...]

You should specify the methods in Red5 like this:
public void changeUserStatus(String id, int status) {}

or
public void changeUserStatus(IConnection conn, String id,
                             int status) {}

That way you can use the passed arguments directly.

Joachim

_______________________________________________
Red5 mailing list
Red5osflash.org

http://osflash.org/mailman/listinfo/red5_osflash.org
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )