
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
8
application.acceptConnection()
application.acceptConnection(clientObj)
Accepts a connection call from a client to the server.
Availability
Flash Communication Server 1
Parameters
clientObj A Client object; a client to accept.
Details
When
NetConnection.connect() is called from the client side, it passes a Client object to
application.onConnect() on the server. Call application.acceptConnection() in an
application.onConnect() event handler to accept a connection from a client. When this method is called,
NetConnection.onStatus() is invoked on the client with the info.code property set to
"NetConnection.Connect.Success".
You c an u s e t h e
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 call this method,
NetConnection.onStatus() is invoked on the client with the info.code property set
to
"NetConnection.Connect.Success". For more information, see the NetStatusEvent.info property in the
ActionScript 3.0 Language and Components Reference or the
NetConnection.onStatus() entry in the Adobe Flash
Media Server ActionScript 2.0 Language Reference.
Note: When you use version 2 components, the last line (in order of execution) of the
onConnect() handler should be
either
application.acceptConnection() or application.rejectConnection() (unless you’re leaving the
application in a pending state). Also, any logic that follows
acceptConnection() or rejectConnection() must be
placed in the
application.onConnectAccept() and application.onConnectReject() handlers, or it will be
ignored.
Example
The following server-side code accepts a client connection and traces the client ID:
application.onConnect = function(client){
// Accept the connection.
application.acceptConnection(client);
trace("connect: " + client.id);
};
Note: This example shows code from an application that does not use components.
application.onPublish() Invoked when a client publishes a stream to an application.
application.onStatus() Invoked when the server encounters an error while processing a message that was
targeted at this application instance.
application.onUnpublish() Invoked when a client stops publishing a stream to an application.
Event handler Description
Komentarze do niniejszej Instrukcji