|
The Client class lets you handle each user, or client,
connection to a Flash Media Server application instance. The server
automatically creates a Client object when a user connects to an
application; the object is destroyed when the user disconnects from
the application. Users have unique Client objects for each application
to which they are connected. Thousands of Client objects can be active
at the same time.
You can use the properties of the Client class to determine the
version, platform, and IP address of each client. You can also set
individual read and write permissions to various application resources
such as Stream objects and shared objects. Use the methods of the
Client class to set bandwidth limits and to call methods in client-side
scripts.
When you call NetConnection.call() from a client-side
ActionScript script, the method that is executed in the server-side
script must be a method of the Client class. In your server-side
script, you must define any method that you want to call from the
client-side script. You can also call any methods that you define in
the server-side script directly from the Client class instance in
the server-side script.
If all instances of the Client class (each client in an application)
require the same methods or properties, you can add those methods
and properties to the class itself instead of adding them to each
instance of a class. This process is called extending a class.
To extend a class, instead of defining methods in the constructor
function of the class or assigning them to individual instances
of the class, you assign methods to the prototype property
of the constructor function of the class. When you assign methods
and properties to the prototype property, the methods
are automatically available to all instances of the class.
The following code shows how to assign methods and properties
to an instance of a class. In the application.onConnect() handler,
the client instance clientObj is passed to the
server-side script as a parameter. You can then assign a property
and method to the client instance.
application.onConnect = function(clientObj){
clientObj.birthday = myBDay;
clientObj.calculateDaysUntilBirthday = function(){
// Insert code here.
}
};
The previous example works, but must be executed every time a
client connects. If you want the same methods and properties to
be available to all clients in the application.clients array
without defining them every time, assign them to the prototype property
of the Client class.
There are two steps to extending a built-in class by using the prototype property.
You can write the steps in any order in your script. The following example
extends the built-in Client class, so the first step is to write
the function that you will assign to the prototype property:
// First step: write the functions.
function Client_getWritePermission(){
// The writeAccess property is already built in to the Client class.
return this.writeAccess;
}
function Client_createUniqueID(){
var ipStr = this.ip;
// The ip property is already built in to the Client class.
var uniqueID = "re123mn"
// You would need to write code in the above line
// that creates a unique ID for each client instance.
return uniqueID;
}
// Second step: assign prototype methods to the functions.
Client.prototype.getWritePermission = Client_getWritePermission;
Client.prototype.createUniqueID = Client_createUniqueID;
// A good naming convention is to start all class method
// names with the name of the class followed by an underscore.
You can also add properties to prototype, as
shown in the following example:
Client.prototype.company = "Adobe";
The methods are available to any instance, so within application.onConnect(),
which is passed a clientObj parameter, you can
write the following code:
application.onConnect = function(clientObj){
var clientID = clientObj.createUniqueID();
var clientWritePerm = clientObj.getWritePermission();
};
AvailabilityFlash
Communication Server 1
Property summary
Property
|
Description
|
Client.agent
|
Read-only; the version and platform of the
client.
|
Client.audioSampleAccess
|
Enables Flash Player to access raw, uncompressed
audio data from streams in the specified folders.
|
Client.id
|
Read-only; a string that uniquely identifies
the client.
|
Client.ip
|
Read-only; A string containing the IP address
of the client.
|
Client.pageUrl
|
Read-only; A string containing the URL of
the web page in which the client SWF file is embedded.
|
Client.protocol
|
Read-only; A string indicating the protocol
used by the client to connect to the server.
|
Client.readAccess
|
A string of directories containing application
resources (shared objects and streams) to which the client has read
access.
|
Client.referrer
|
Read-only; A string containing the URL of
the SWF file or the server in which this connection originated.
|
Client.secure
|
Read-only; A boolean value that indicates
whether this is an SSL connection (true) or not
(false).
|
Client.uri
|
Read-only; the URI specified by the client
to connect to this application instance.
|
Client.videoSampleAccess
|
Enables Flash Player to access raw, uncompressed
video data from streams in the specified folders.
|
Client.virtualKey
|
A virtual mapping for clients connecting
to the server.
|
Client.writeAccess
|
Provides write access to directories that
contain application resources (such as shared objects and streams)
for this client.
|
Client.agentclientObject.agent
Read-only; the version and platform of the client.
When a client connects to the server, the format of Client.agent is
as follows:
Operating_System Flash_Player_Version
For example, if Flash Player version 9.0.45.0 is running on Windows,
the value of Client.agent is:
"WIN 9,0,45,0".
When a connection is made to another Flash Media Interactive
Server, the format of Client.agent is as follows:
Server_Name/Server_Version Operating_System/Operating_System_Build
For example, if the server version is 3.0.0 and it’s running
on Windows Server 2003, the value of Client.agent is:
"FlashCom/3.0.0 WIN/5.1.2600".
AvailabilityFlash
Communication Server 1
ExampleThe
following example checks the agent property against
the string "WIN" and executes different code depending
on whether they match. This code is written in an onConnect() function:
function onConnect(newClient, name){
if (newClient.agent.indexOf("WIN") > -1){
trace ("Window user");
} else {
trace ("non Window user.agent is" + newClient.agent);
}
}
Client.audioSampleAccessclientObject.audioSampleAccess
Enables Flash Player to access raw, uncompressed audio data from
streams in the specified folders.
Call the SoundMixer.computeSpectrum() method
in client-side ActionScript 3.0 to read the raw sound data for a
waveform that is currently playing. For more information, see the SoundMixer.computeSpectrum() entry
in the ActionScript 3.0 Language and Components Reference and
“Accessing raw sound data” in Programming ActionScript 3.0.
AvailabilityFlash
Media Interactive Server 3 and Flash Media Development Server 3
ExampleThe
following server-side code sets the audioSampleAccess directory
to publicdomain:
application.onConnect = function(client) {
// Anyone can play free content, which is all streams placed under the
// samples/, publicdomain/ and contrib/ folders.
client.readAccess = "samples;publicdomain;contrib";
// Paying customers get to watch more streams.
if ( isPayingCustomer(client))
client.readAccess += "nonfree;premium";
// Content can be saved (user recorded streams) to contrib/ folder.
client.writeAccess = "contrib";
// Anyone can gain access to an audio snapshot of the publicdomain/ folder.
client.audioSampleAccess = "publicdomain";
// Paying customers can also get a video snapshot of the publicdomain/ folder.
if (isPayingCustomer(client))
client.videoSampleAccess = "publicdomain";
}
Client.call()clientObject.call(methodName, [resultObj, [p1, ..., pN]])
Executes a method in client-side code or on another server. The
remote method can return data to the resultObj parameter,
if provided. Whether the remote agent is a client or another server,
the method is called on the remote agent’s NetConnection object.
In ActionScript 2.0, define the method on the NetConnection object.
In ActionScript 3.0, assign the NetConnection.client property
to an object on which callback methods are invoked. Define the method
on that object.
AvailabilityFlash
Communication Server 1
Parameters- methodName
- A string indicating a remote method. The string uses the
form "[objectPath/]method". For example, the string "someObj/doSomething" tells
the client to invoke the NetConnection.someObj.doSomething() method
on the client or remote server. The string "doAction" calls
the doAction() method on the client or remote server.
- resultObj
- An Object. This is an optional parameter that is required
when the sender expects a return value from the client. If parameters
are passed but no return value is desired, pass the value null.
The result object can be any object that you define. To be useful,
it should have two methods that are invoked when the result arrives: onResult() and onStatus().
The resultObj.onResult() event is triggered if
the invocation of the remote method is successful; otherwise, the resultObj.onStatus() event
is triggered.
- p1, ..., pN
- Optional parameters that can be of any ActionScript type, including
a reference to another ActionScript object. These parameters are passed
to the methodName parameter when the method is
executed on the Flash client. If you use these optional parameters,
you must pass in some value for resultObj; if you
do not want a return value, pass null.
ReturnsA boolean
value of true if a call to methodName was
successful on the client; otherwise, false.
ExampleThe
following ActionScript 2.0 example shows a client-side script that
defines a function called getNumber() that generates
a random number:
nc = new NetConnection();
nc.getNumber = function(){
return (Math.random());
};
nc.connect("rtmp:/clientCall");
The following is
the same code in ActionScript 3.0:
var nc:NetConnection = new NetConnection()
var ncClient = new Object();
nc.client = ncClient;
ncClient.getNumber = nc_getNumber;
function nc_getNumber():void{
return (Math.random());
}
The following server-side script calls Client.call() in
the application.onConnect() handler to call the getNumber() method that
was defined on the client. The server-side script also defines a
function called randHander(), which is used in
the Client.call() method as the resultObj parameter.
randHandler = function(){
this.onResult = function(res){
trace("Random number: " + res);
}
this.onStatus = function(info){
trace("Failed with code:" + info.code);
}
};
application.onConnect = function(clientObj){
trace("Connected");
application.acceptConnection(clientObj);
clientObj.call("getNumber", new randHandler());
};
Note: This example does not work with
version 2 components. For an example of calling Client.call() when
using version 2 components, see application.onConnectAccept().
Client.checkBandwidth()clientObject.checkBandwidth()
Call this method from a client-side script to detect client bandwidth.
If the client is connected directly to the origin server, bandwidth
detection occurs on the origin. If the client is connected to the
origin server through an edge server, bandwidth detection happens
at the first edge to which the client connected.
To use this method to detect client bandwidth, define onBWDone() and onBWCheck() methods
in a client-side script. For more information, see the Adobe Flash Media Server Developer Guide.
Note: If you define the checkBandwidth() function
in a server-side script, the client call runs your definition instead
of the definition in the core server code.
AvailabilityFlash
Media Interactive Server 3 and Flash Media Development Server 3
Client.getBandwidthLimit()clientObject.getBandwidthLimit(iDirection)
Returns the maximum bandwidth that the client or the server can
use for this connection. Use the iDirection parameter
to get the value for each direction of the connection. The value
returned indicates bytes per second and can be changed with the Client.setBandwidthLimit() method.
Set the default value for a connection in the Application.xml file
of each application.
You can call this method from a client-side script. Call the NetConnection.call() method
and pass it the name of the method, a result object, and any arguments,
as in the following: var re:Responder = new Responder(res);
function res(info) {
trace(info);
for (var i:String in info) { trace(i + " - " + info[i]); }
}
nc.call("getBandwidthLimit", re, 0);
AvailabilityFlash
Communication Server 1
Parameters- iDirection
- A number specifying the connection direction. The value 0 indicates
a client-to-server direction; 1 indicates a server-to-client direction.
ExampleThe
following example uses Client.getBandwidthLimit() to
set the variables clientToServer and serverToClient:
application.onConnect = function(newClient){
var clientToServer= newClient.getBandwidthLimit(0);var serverToClient= newClient.getBandwidthLimit(1);
};
Client.getStats()clientObject.getStats()
Returns statistics for the client.
You can call this method from a client-side script. Call the NetConnection.call() method
and pass it the name of the method, a result object, and any arguments,
as in the following: var re:Responder = new Responder(res);
function res(info) {
trace(info);
for (var i:String in info) { trace(i + " - " + info[i]); }
}
nc.call("getStats", re);
AvailabilityFlash
Communication Server 1
ReturnsAn
Object with various properties for each statistic returned. The
following table describes the properties of the returned object:
Property
|
Description
|
bytes_in
|
Total number of bytes received.
|
bytes_out
|
Total number of bytes sent.
|
msg_in
|
Total number of RTMP messages received.
|
msg_out
|
Total number of RTMP messages sent.
|
msg_dropped
|
Total number of dropped RTMP messages.
|
ping_rtt
|
Length of time the client takes to respond
to a ping message.
|
audio_queue_msgs
|
Current number of audio messages in the
queue waiting to be delivered to the client.
|
video_queue_msgs
|
Current number of video messages in the
queue waiting to be delivered to the client.
|
so_queue_msgs
|
Current number of shared object messages
in the queue waiting to be delivered to the client.
|
data_queue_msgs
|
Current number of data messages in the queue
waiting to be delivered to the client.
|
dropped_audio_msgs
|
Number of audio messages that were dropped.
|
dropped_video_msgs
|
Number of video messages that were dropped.
|
audio_queue_bytes
|
Total size of all audio messages (in bytes)
in the queue waiting to be delivered to the client.
|
video_queue_bytes
|
Total size of all video messages (in bytes)
in the queue waiting to be delivered to the client.
|
so_queue_bytes
|
Total size of all shared object messages
(in bytes) in the queue waiting to be delivered to the client.
|
data_queue_bytes
|
Total size of all data messages (in bytes)
in the queue waiting to be delivered to the client.
|
dropped_audio_bytes
|
Total size of all audio messages (in bytes)
that were dropped.
|
dropped_video_bytes
|
Total size of all video messages (in bytes)
that were dropped.
|
bw_out
|
Current upstream (client to server) bandwidth
for this client.
|
bw_in
|
Current downstream (server to client) bandwidth
for this client.
|
client_id
|
A unique ID issued by the server for this
client.
|
ExampleThe
following example outputs a client’s statistics:
function testStats(){
var stats = client.getStats();
for(var prop in stats){
trace("stats." + prop + " = " + stats[prop]);
}
}
application.onConnect = function(client){
this.acceptConnection(client);
testStats();
};
Client.idclientObject.id
Read-only; a string that uniquely identifies the client.
AvailabilityFlash
Media Server 3
ExampleThe
following onConnect() function traces the ID of
the connecting client:
application.onConnect(newClient) {
trace(newClient.id);
}
Client.ipclientObject.ip
Read-only; A string containing the IP address of the client.
AvailabilityFlash
Communication Server 1
ExampleThe
following example uses the Client.ip property to
verify whether a new client has a specific IP address. The result
determines which block of code runs.
application.onConnect = function(newClient, name){
if (newClient.ip == "127.0.0.1"){
// Insert code here.
} else {
// Insert code here.
}
};
Client.pageUrlclientObject.pageUrl
Read-only; A string containing the URL of the web page in which
the client SWF file is embedded. If the SWF file isn’t embedded
in a web page, the value is the location of the SWF file. The following
code shows the two examples:
// trace.swf file is embedded in trace.html.
client.pageUrl: http://www.example.com/trace.html
// trace.swf is not embedded in an html file.
client.pageUrl: http://www.example.com/trace.swf
The value cannot be a local file address.
AvailabilityFlash
Media Server 2
ExampleThe
following example uses the Client.pageUrl property
to verify whether a new client is located at a particular URL. The
result determines which block of code runs.
application.onConnect = function(newClient){
if (newClient.pageUrl == "http://www.example.com/index.html"){
return true;
} else {
return false;
}
};
Client.ping()clientObject.ping()
Sends a “ping” message to the client and waits for a response.
If the client responds, the method returns true;
otherwise, false. Use this method to determine
whether the client connection is still active.
AvailabilityFlash
Communication Server 1
ExampleThe
following onConnect() function pings the connecting
client and traces the results of the method:
application.onConnect(newClient) {
if (newClient.ping()){
trace("ping successful");
}
else {
trace("ping failed");
}
}
Client.protocolclientObject.protocol
Read-only; A string indicating the protocol used by the client
to connect to the server. This string can have one of the following
values:
Protocol
|
Description
|
rtmp
|
RTMP over a persistent socket connection.
|
rtmpt
|
RTMP tunneled over HTTP.
|
rtmps
|
RTMP over an SSL (Secure Socket Layer) connection.
|
rtmpe
|
An encrypted RTMP connection.
|
rtmpte
|
An encrypted RTMP connection tunneled over
HTTP.
|
AvailabilityFlash
Communication Server 1
ExampleThe
following example checks the connection protocol used by a client
upon connection to the application:
application.onConnect(clientObj){
if(clientObj.protocol == "rtmp") {
trace("Client connected over RTMP");
} else if(clientOjb.protocol == "rtmpt") {
trace("Client connected over RTMP tunneled over HTTP");
}
}
Client.readAccessclientObject.readAccess
A string of directories containing application resources (shared
objects and streams) to which the client has read access. To give
a client read access to directories that contain application resources,
list the directories in a string delimited by semicolons.
AvailabilityFlash
Communication Server 1
DetailsBy
default, all clients have full read access, and the readAccess property
is set to slash (/). To give a client read access,
specify a list of access levels (in URI format), delimited by semicolons.
Any files or directories within a specified URI are also considered
accessible. For example, if myMedia is specified
as an access level, any files or directories in the myMedia directory
are also accessible (for example, myMedia/mp3s). Similarly, any
files or directories in the myMedia/mp3s directory are also accessible,
and so on.
Clients with read access to a directory that contains
streams can play streams in the specified access levels. Clients
with read access to a directory that contains shared objects can
subscribe to shared objects in the specified access levels and receive
notification of changes in the shared objects.
For
streams, readAccess controls the streams that the
connection can play.
For shared objects, readAccess controls
whether the connection can listen to shared object changes.
Although
you cannot use this property to control access for a particular
file, you can create a separate directory for a file if you want
to control access to it.
Note: You cannot set this
property in the application.onPublish() event.
ExampleThe
following onConnect() function gives a client read
access to myMedia/mp3s, myData/notes, and any files or directories
within them:
application.onConnect = function(newClient, name){
newClient.readAccess = "myMedia/mp3s;myData/notes";
};
Client.referrerclientObject.referrer
Read-only; A string containing the URL of the SWF file or the
server in which this connection originated. The property is set
when a SWF hosted on a web server or connects to an application
on Flash Media Server. The property is also set when one Flash Media
Server connects to another.
This property is not set when a SWF from a local file system
running in stand-alone Flash Player version 10 or above connects
to Flash Media Server. If a SWF file is running in standalone Flash
Player version 8 or 9, the property is set as file:///....
AvailabilityFlash
Communication Server 1
Exampleapplication.onConnect = function(newClient, name){
trace("New user connected to server from" + newClient.referrer);
};
Client.remoteMethod()myClient.remoteMethod = function([p1, ..., pN]){}
You can define methods on the Client object and call the methods
from client-side code. To call methods from client-side code, call
the NetConnection.call() method and pass it the
name of the method you defined. The server searches the Client object
instance for the method. If the method is found, it is invoked and
the return value is sent back to the result object specified in
the call to NetConnection.call().
AvailabilityFlash
Communication Server 1
Parameters- p1, ..., pN
- Optional parameters passed to the NetConnection.call() method.
ExampleThe
following example creates a method called sum() as
a property of the Client object newClient on the
server side:
Client.prototype.sum = function(op1, op2){
return op1 + op2;
};
You can call the server-side sum() method
from a client-side call to the NetConnection.call() method:
nc = new NetConnection();
nc.connect("rtmp://myServer/myApp");
nc.call("sum", new result(), 20, 50);
function result(){
this.onResult = function (retVal){
output += "sum is " + retVal;
};
this.onStatus = function(errorVal){
output += errorVal.code + " error occurred";
};
}
You can also call the sum() method
in server-side code:
newClient.sum();
The
following example creates two functions that you can call from either
a client-side or server-side script:
application.onConnect = function(clientObj) {
// The function foo returns 8.
clientObj.foo = function() {return 8;};
// The function bar is defined outside the onConnect call.
clientObj.bar = application.barFunction;
};
// The bar function adds the two values it is given.
application.barFunction = function(v1,v2) {
return (v1 + v2);
};
You can call either of the two functions that
were defined in the previous example (foo and bar)
by using the following code in a client-side script:
c = new NetConnection();
c.call("foo");
c.call("bar", null, 1, 1);
You can call either of
the two functions that were defined in the previous example (foo and bar)
by using the following code in a server-side script:
c = new NetConnection();
c.onStatus = function(info) {
if(info.code == "NetConnection.Connect.Success") {
c.call("foo");
c.call("bar", null, 2, 2);
}
};
Client.__resolve()Client.__resolve = function(propName){}
Provides values for undefined properties. When an undefined property
of a Client object is referenced by Server-Side ActionScript code,
the Client object is checked for a _resolve() method.
If the object has a _resolve() method, it is invoked
and passed the name of the undefined property. The return value
of the _resolve() method is the value of the undefined
property. In this way, _resolve() can supply the
values for undefined properties and make it appear as if they are
defined.
AvailabilityFlash
Communication Server 1
Parameters- propName
- A string indicating the name of an undefined property.
ReturnsThe
value of the property specified by the propName parameter.
ExampleThe
following example defines a function that is called whenever an
undefined property is referenced:
Client.prototype.__resolve = function (name) {
return "Hello, world!";
};
function onConnect(newClient){
// Prints "Hello World".
trace (newClient.property1);
}
Client.secureclientObject.secure
Read-only; A boolean value that indicates whether this is an
SSL connection (true) or not (false).
AvailabilityFlash
Media Server 2
Client.setBandwidthLimit()clientObject.setBandwidthLimit(iServerToClient, iClientToServer)
Sets the maximum bandwidth for this client from client to server,
server to client, or both. The default value for a connection is
set for each application in the Client section
of the Application.xml file. The value specified cannot exceed the
bandwidth cap value specified in the Application.xml file. For more
information, see BandwidthCap in the Adobe Flash Media Server Configuration and Administration Guide.
You can call this method from a client-side script. Call the NetConnection.call() method
and pass it the name of the method, a result object, and any arguments,
as in the following: var re:Responder = new Responder(res);
function res(info) {
trace(info);
for (var i:String in info) { trace(i + " - " + info[i]); }
}
nc.call("setBandwidthLimit", re, 125000, 125000);
AvailabilityFlash
Communication Server 1
Parameters- iServerToClient
- A number; the bandwidth from server to client, in bytes per
second. Use 0 if you don’t want to change the current setting.
- iClientToServer
- A number; the bandwidth from client to server, in bytes per
second. Use 0 if you don’t want to change the current setting.
ExampleThe
following example sets the bandwidth limits for each direction,
based on values passed to the onConnect() function:
application.onConnect = function(newClient, serverToClient, clientToServer){
newClient.setBandwidthLimit(serverToClient, clientToServer);
application.acceptConnection(newClient);
}
Client.uriclientObject.uri
Read-only; the URI specified by the client to connect to this
application instance.
AvailabilityFlash
Media Server 2
ExampleThe
following example defines an onConnect() callback
function that sends a message indicating the URI that the new client
used to connect to the application:
application.onConnect = function(newClient, name){
trace("New user requested to connect to " + newClient.uri);
};
Client.videoSampleAccessclientObject.videoSampleAccess
Enables Flash Player to access raw, uncompressed video data from
streams in the specified folders.
Call the BitmapData.draw() method in client-side
ActionScript 3.0 to read the raw data for a stream that is currently
playing. For more information, see the BitmapData.draw() entry
in ActionScript 3.0 Language and Components Reference.
AvailabilityFlash
Media Interactive Server 3 and Flash Media Development Server 3
ExampleThe
following server-side code sets the videoSampleAccess directory
to publicdomain for paying customers:
application.onConnect = function(client) {
// Anyone can play free content, which is all streams placed under the
// samples/, publicdomain/, and contrib/ folders.
client.readAccess = "samples;publicdomain;contrib";
// Paying customers get to watch more streams.
if ( isPayingCustomer(client))
client.readAccess += "nonfree;premium";
// Content can be saved (user recorded streams) to the contrib/ folder.
client.writeAccess = "contrib";
// Anyone can gain access to an audio snapshot of the publicdomain/ folder.
client.audioSampleAccess = "publicdomain";
// Paying customers can also get a video snapshot of the publicdomain/ folder.
if (isPayingCustomer(client))
client.videoSampleAccess = "publicdomain";
}
Client.virtualKeyclientObject.virtualKey
Use this property in conjunction with the Stream.setVirtualPath() method
to map stream URLs to physical locations on the server. This allows
you to serve different content to different versions of Flash Player.
When a client connects, it receives a virtual key that corresponds
to ranges that you set in the Vhost.xml file. You can use Client.virtualKey to
change that value in a server-side script. The following is the
code in the Vhost.xml file that you must configure:
<VirtualKeys>
<!-- Create your own ranges and key values. -->
<!-- You can create as many Key elements as you need. -->
<Key from="WIN 7,0,19,0" to="WIN 9,0,0,0">A</Key>
</VirtualKeys>
Using the previous Vhost.xml file, if a Flash Player 8 client
connected to the server, its Client.virtualKey value
would be A.
Note: A legal key cannot contain the characters “*”
and “:”.
AvailabilityFlash
Media Server 2
Client.writeAccessclientObject.writeAccess
Provides write access to directories that contain application
resources (such as shared objects and streams) for this client.
To give a client write access to directories that contain application
resources, list directories in a string delimited by semicolons.
By default, all clients have full write access, and the writeAccess property
is set to slash (/). For example, if myMedia is
specified as an access level, then any files or directories in the
myMedia directory are also accessible (for example, myMedia/myStreams).
Similarly, any files or subdirectories in the myMedia/myStreams
directory are also accessible, and so on.
For shared objects, writeAccess provides
control over who can create and update the shared objects.
For streams, writeAccess provides control
over who can publish and record a stream.
You cannot use this property to control access to a single file.
To control access to a single file, create a separate directory
for the file.
Don’t precede the stream path with a leading slash (/) on the
client side.
Note: You cannot set this property in the application.onPublish() event.
AvailabilityFlash
Communication Server 1
ExampleThe
following example provides write access to the /myMedia/myStreams
and myData/notes directories:
application.onConnect = function(newClient, name){
newClient.writeAccess = "/myMedia/myStreams;myData/notes";
application.acceptConnection();
};
The following example completely disables write
access:
application.onConnect = function(clientObj){
clientObj.writeAccess = "";
return true;
};
|
|
|