Flash Media Server |
|||
| Server-Side ActionScript Language Reference > Server-Side ActionScript Language Reference > Application class > Application.broadcastMsg() | |||
Flash Media Server 2.
application.broadcastMsg(cmd[,p1,p2, ...,pN])
cmd A string; a message to broadcast.
p1 A string; additional messages.
Nothing.
Method; broadcasts a message to all connected clients.
This method is equivalent to looping through the Application.clients array and calling Client.call() on each individual client, but is more efficient (especially for large number of connected clients). The only difference is that you can't specify a response object when you call broadcastMsg(), otherwise, the syntax is the same.
Shared objects can handle broadcast messages with the SharedObject.handlerName property.
The following server-side code sends a message to the client:
application.broadcastMsg("handlerName", "Hello World");
The following client-side code catches the message and prints it in the Output panel:
nc = new NetConnection();
nc.handlerName = function(msg) { trace(msg); }
// traces out "Hello World"
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/fms/2/docs/00000643.html
Comments
BcisR_D said on Nov 18, 2009 at 10:15 AM :