User Guide
108 Server-Side ActionScript Language Reference
It is good practice to write an application.onStatus callback function and check the
NetConnection.isConnected property for RTMP connections to see whether a successful
connection was made. For Action Message Format connections, check
NetConnection.onStatus.
About secure connections
Flash Media Server accepts only RTMPS connections on designated secure ports. A port is
marked as secure by specifying a minus sign (-) in front of the port in the
HostPort tag of the
Adaptor.xml file, as shown in the following code:
<HostPort>:1935,80,-443</HostPort>
This code specifies that FMS can listen on any interface, on ports 1935, 80, and 443, where
443 is designated as a secure port that receives only RTMPS connections. Attempting an
RTMPS connection to 1935 or 80 fails because the client tries to perform an SSL
“handshake” that the server cannot complete. Similarly, a regular RTMP connection to port
443 fails because the server tries to perform an SSL handshake that the client cannot
complete.
You can determine whether a connection to the server is over a secure channel by checking the
server-side
Client.secure property, as shown in the following example:
application.onConnect = function(client){
if (client.secure){
trace("This client is connected over a secure connection.");
}
}
Creating a debugging connection
You can append a property and key to an Internet connection request to create a debug
connection. A debug connection gives you greater access to an application; for example, you
can play streams and view shared objects.
To create a debug connection:
■ Call NetConnection.connect() and append a 4-digit debug request number, as shown
in the following example:
nc.connect("rtmp://fmsaddress/appName/instanceName?_fcs_debugreq_=1234
For security, the Internet connection is put in a pending state.
■ Call the server management API approveDebugSession() and pass it the same debug
request number.
The debug connection attempts to connect to the application.