User Guide

30 Flash Media Server Architecture
Understanding connection flow
The client connects to the server, and the server calls onAppStart when the application
instance is loaded (if the application is already running,
onAppStart is not called). Next, the
server-side
onConnect handler is invoked with a newly created Client object. The logic in this
method determines whether to accept or reject the connection. On the client side, the
onStatus handler is called to report whether the connection was accepted or rejected. When
the client closes the connection, the server-side
onDisconnect handler is called. When the
application is unloaded,
onAppStop is invoked.
To accept the connection in the
onConnect handler, return true or call
application.acceptConnection(); to reject the connection, return false or call
application.rejectConnection(). If true or false are not returned in the onConnect
handler, clients remain pending until
acceptConnection() or rejectConnection() is
called.
Connection flow
NOTE
Only the client application can initiate a communication session. Both the client and the
server send and receive status messages, open and close streams, save and share data,
and end the network connection.
SERVER FLOW
onAppStart
new Client object onConnect
acceptConnection
onDisconnect
Application is
unloaded
onAppStop
CLIENT FLOW
connect
onStatus
close