MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Manuel d'utilisateur Page 19

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 80
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 18
Server-Side Communication ActionScript 19
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.
How to use application.onConnect to accept, reject, or put a client in a pending state
Description
Event handler; invoked on the server side when NetConnection.connect is called from the
client side and a client attempts to connect to an application instance. You can define a function
for the
application.onConnect event handler. If you dont define a function, connections are
accepted by default. If the server accepts the new connection, the
application.clients object
is updated.
You can use the
application.onConnect event in server-side scripts to perform authentication.
All the information required for authentication should be sent to the server by the client as
parameters (
p1 ..., pN) that you define. In addition to authentication, the script can set the access
rights to all server-side objects that this client can modify by setting the
Client.readAccess and
Client.writeAccess properties.
If there are several simultaneous connection requests for an application, the server serializes the
requests so there is only one
application.onConnect handler executing at a time. It is a good
idea to write code for the
application.onConnect function that executes quickly to prevent a
long connection time for clients.
Note: If you are using the Component framework (that is, you are loading the components.asc file in your server-
side script file) you must use the Application.onConnectAccept method to accept client connections. For more
information see Application.onConnectAccept.
New Client object
(not accepted or rejected yet)
NetConnection.connect
Pending clientApplication.onConnect
Server-side ActionScript
true, acceptConnection
false, rejectConnection
Client-side ActionScript
Rejected
client
Accepted
client
rejectConnection
acceptConnection
none, null
Vue de la page 18
1 2 ... 14 15 16 17 18 19 20 21 22 23 24 ... 79 80

Commentaires sur ces manuels

Pas de commentaire