
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
17
If there are several simultaneous connection requests for an application, the server serializes the requests so that only
one
application.onConnect() handler is executed at a time. It’s a good idea to write code for the
application.onConnect() function that is executed quickly to prevent a long connection time for clients.
Note: When you are using the version 2 component framework (that is, when you are loading the components.asc file
in your server-side script file), you must use the
application.onConnectAccept() method to accept client connec-
tions.
Availability
Flash Communication Server 1
Parameters
clientObj A Client object. This object contains information about the client that is connecting to the application.
p1 ..., pN Optional parameters passed to the application.onConnect() handler from the client-side
NetConnection.connect() method when a client connects to the application.
Returns
A boolean value;
true causes the server to accept the connection; false causes the server to reject the connection.
When
true is returned, NetConnection.onStatus() is invoked on the client with info.code set to
"NetConnection.Connect.Success". When false is returned, NetConnection.onStatus() is invoked on the
client with
info.code set to "NetConnection.Connect.Rejected".
If
null or no value is returned, the server puts the client in a pending state and the client can’t receive or send
messages. If the client is put in a pending state, you must call
application.acceptConnection() or
application.rejectConnection() at a later time to accept or reject the connection. For example, you can
perform external authentication by making a NetConnection call in your
application.onConnect() event
handler to an application server and having the reply handler call
application.acceptConnection() or
application.rejectConnection(), depending on the information received by the reply handler.
You can also call
application.acceptConnection() or application.rejectConnection() in the
application.onConnect() event handler. If you do, any value returned by the function is ignored.
Note: Returning 1 or 0 is not the same as returning
true or false. The values 1 and 0 are treated the same as any other
integers and do not accept or reject a connection.
Kommentare zu diesen Handbüchern