User Guide

XMLSocket class 223
Example
The following example executes a trace() statement if an open connection is closed by the
server:
var socket = new XMLSocket();
socket.connect(null, 2000);
socket.onClose = function () {
trace("Connection to server lost.");
}
See also
XMLSocket.onConnect
XMLSocket.onConnect
Availability
Flash Media Server 2.
Usage
myXMLSocket.onConnect = function(success) {}
Parameters
success A Boolean value indicating whether a socket connection is successfully established
(
true or false).
Returns
Nothing.
Description
Event handler; invoked by Flash Media Server when a connection request initiated through
XMLSocket.connect() has succeeded or failed. If the connection succeeded, the success
parameter is
true; false otherwise.
The default implementation of this method performs no actions. To override the default
implementation, you must assign a function containing custom actions.
NOTE
In Flash Media Server, the output of trace() statements appears in the application log
file and Application inspector.