Application class
19
Description
Property; a Boolean value that allows Administrators to access your application with the
approveDebugSession()
Server Management API (
true
) or not (
false
). A debug
connection displays information about shared objects and streams.
For information about creating a debug connection, see
NetConnection.connect()
and
approveDebugSession()
.
Application.broadcastMsg()
Availability
Flash Media Server 2.
Usage
application.broadcastMsg(
cmd
[,
p1
,
p2
, ...,
pN
])
Parameters
cmd
A string; a message to broadcast.
p1
A string; additional messages.
Returns
Nothing.
Description
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.
Example
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"