Using the FMS http admin call, broadcastMsg

For the past few days I have been trying to find out how to use the FMS http admin call broadcastMsg. In the Adobe docs it states:

Command: broadcastMsg
Required Arguments: scope, method

Optional Arguments: arg0, arg1, arg2 ...

Sample URL: /admin/broadcastMsg?scope="App:myApp"&method="myMethod"&arg0="foo"&arg1="bar"

Well that's all fine and dandy.. but there is no other documentation. Working with a friend of mine, Fernando Flórez, we were able to get it working.. more him than me.. :-)

So the secret? Well I kept trying something like so:
/admin/broadcastMsg?scope="new_ap:new_app_instance"&method="myMethod"

And I kept getting a:
<result>
<level>error</level>
<code>NetConnection.Admin.CommandFailed</code>
<timestamp>Fri Mar 7 12:06:14 2008</timestamp>
</result>

Baffled as I was I kept trying..but to no avail. I read a writeup Fernando did on his blog.. here:
http://blog.funciton.com/en/2007/12/broadcast_message_to_fms_witho.html

Well.. I contacted him and neither of us could crack it.. until..

Fernando had gotten this working for a client and so upon further introspection of that project the following was revealed:

/admin/broadcastMsg?scope="App:new_ap/new_app_instance"&method="myMethod"
worked! No more error messages.. but success. So the word "App" in the http command is a reserved word. It's just a matter of forming it properly.

This method will call a clientside method called myMethod that is exposed through the NetConnection.

So.. reserved words are:
Adaptor
VHost
App

With those you can successfully target specific applications on your FMS instance.

I hope that helps someone out.. seeing as docs to this are far and few between.

Hello.. You cannot use

Hello..
You cannot use broadcaster via the HTTP call to call a method of the specific app you're targeting. Broadcasting can only be used to call that command on clients connected to the application. Free Samples By Mail

Help with broadcastMsg

Hi Jake. I was wondering if you might be able to lend a little advice on about using broadcastMsg. I actually am getting a success response back from the FMS Admin API through RTMP, but the method doesn't seem to actually be getting called on the server. I've created a method like so:

Client.prototype.getClientIPs = function()
{
trace( 'ip is 127.0.0.1' );
ips = new Array();
ips.push( '127.0.0.1' );
return ips;
}

I can call it fine from a standard NetConnection and see the trace output in the FMS Admin Console:
_nc.call( 'getClientIPs', responder );
However, when I try to invoke the method from the Admin API, it never seems to run. I've tried defining the method on the application instead, with no luck. It never traces in the log. Do you have any suggestions? Thanks!

According to the docs, the

According to the docs, the admin command broadcasting broadcasts to clients, not to applications. That would explain why it's not calling the application method. Also, there's nothing in the broadcasting method that supports returning of data. Free Samples By Mail

Broadcasting commands to the server

You cannot use broadcastmsg via the http call to call a method of the specific app you're targeting. Broadcastmsg can only be used to call that command on clients connected to the application. So if you wanted to call that method you'd have to have the application create a netconnection to itself for the broadcastmsg to call.

I hope that makes sense.

Happy flashing!
Jake