Server-Side Communication ActionScript > Application.acceptConnection |
![]() ![]() ![]() |
Application.acceptConnection
Availability
Flash Communication Server MX.
Usage
application.acceptConnection(clientObj
)
Parameters
clientObj
A client to accept.
Returns
Nothing.
Description
Method; accepts the connection call from a client to the server. The application.onConnect
event handler is invoked on the server side to notify a script when NetConnection.connect
is called from the client side. You can use the application.acceptConnection
method inside an application.onConnect
event handler to accept a connection from a client. You can use the application.acceptConnection
method outside an application.onConnect
event handler to accept a client connection that had been placed in a pending state (for example, to verify a user name and password).
When you use components and your code includes an explicit call to application.acceptConnection
or application.rejectConnection
, the last line (in order of execution) of the onConnect method should be either application.acceptConnection
or application.rejectConnection
. Also, any logic that follows the explicit acceptConnection or rejectConnection statement must be placed in application.onConnectAccept
and application.onConnectReject
statements, or it will be ignored. This requirement exists only when you use components.
Example
The following example uses the application.acceptConnection
method to accept the connection from client1
:
application.onConnect = function (client1){ // insert code here application.acceptConnection(client1); client1.call("welcome"); };
Note: The example above shows code from an application that does not use components.
See also
Application.onConnect
, Application.rejectConnection
![]() ![]() ![]() |