Flash Media Server Developer Documentation

Managing connections in server-side code

An application might also have server-side code in a main.asc or applicationName.asc file that manages clients trying to connect (see Writing server-side code for an introduction).

The server-side code has access to client objects, which represent individual clients on the server side, and a single application object, which enables you to manage the application instance. In the server code, you use Server-Side ActionScript and the server-side information objects (see the Server-Side ActionScript Language Reference).

In the server-side code, the application can accept or reject connections from clients, shut down the application, and perform other tasks to manage the connection. When a client connects, the application receives an application.onConnect event. Likewise, when the client disconnects, the application receives an application.onDisconnect event.

To manage the connection from the server, start with application.onConnect() and application.onDisconnect() in Server-Side ActionScript.