Package | net.user1.reactor |
Class | public class ConnectionManagerEvent |
Inheritance | ConnectionManagerEvent ![]() |
Since : | Reactor 1.0.0 |
See also
Method | Defined By | ||
---|---|---|---|
ConnectionManagerEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, connection:IConnection = null, status:String = null)
Initializes a new ConnectionManagerEvent object. | ConnectionManagerEvent | ||
clone():Event [override] | ConnectionManagerEvent | ||
Returns the underlying IConnection object to which this event pertains. | ConnectionManagerEvent | ||
getStatus():String
Returns the status of the event. | ConnectionManagerEvent | ||
toString():String [override] | ConnectionManagerEvent |
Constant | Defined By | ||
---|---|---|---|
BEGIN_CONNECT : String = BEGIN_CONNECT [static]
An event triggered when a connection attempt by the ConnectionManager
begins. | ConnectionManagerEvent | ||
CLIENT_KILL_CONNECT : String = CLIENT_KILL_CONNECT [static]
An event triggered when the client closes an active connection. | ConnectionManagerEvent | ||
CONNECT_FAILURE : String = CONNECT_FAILURE [static]
An event triggered when a connection attempt by the ConnectionManager
fails. | ConnectionManagerEvent | ||
CONNECTION_STATE_CHANGE : String = CONNECTION_STATE_CHANGE [static]
An event triggered when the ConnectionManager's state changes (e.g., from
"CONNECTION_IN_PROGRESS" to "READY"). | ConnectionManagerEvent | ||
DISCONNECT : String = DISCONNECT [static]
An event triggered when either the client or the server
closes an active connection. | ConnectionManagerEvent | ||
READY : String = READY [static]
An event triggered when one of the IConnection objects in the
ConnectionManager's connection list achieves a READY state. | ConnectionManagerEvent | ||
SELECT_CONNECTION : String = SELECT_CONNECTION [static]
An event triggered when the ConnectionManager selects an IConnection
object for a connection attempt. | ConnectionManagerEvent | ||
SERVER_KILL_CONNECT : String = SERVER_KILL_CONNECT [static]
An event triggered when the server closes an active connection. | ConnectionManagerEvent |
ConnectionManagerEvent | () | Constructor |
public function ConnectionManagerEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, connection:IConnection = null, status:String = null)
Since : | Reactor 1.0.0 |
Initializes a new ConnectionManagerEvent object.
Parameterstype:String | |
bubbles:Boolean (default = false )
| |
cancelable:Boolean (default = false )
| |
connection:IConnection (default = null )
| |
status:String (default = null )
|
clone | () | method |
override public function clone():Event
ReturnsEvent |
getConnection | () | method |
public function getConnection():IConnection
Since : | Reactor 1.0.0 |
Returns the underlying IConnection object to which this event pertains. The getConnection() method is available for the following events:
IConnection |
getStatus | () | method |
public function getStatus():String
Since : | Reactor 1.0.0 |
Returns the status of the event. The getStatus() method is available for the ConnectionManagerEvent.CONNECT_FAILURE event only.
ReturnsString |
toString | () | method |
override public function toString():String
ReturnsString |
BEGIN_CONNECT | Constant |
public static const BEGIN_CONNECT:String = BEGIN_CONNECT
Since : | Reactor 1.0.0 |
An event triggered when a connection attempt by the ConnectionManager begins. The ConnectionManagerEvent.BEGIN_CONNECT event is followed by a ConnectionManagerEvent.SELECT_CONNECTION event, which indicates the specific IConnection object the ConnectionManager will use for its connection attempt.
See also
CLIENT_KILL_CONNECT | Constant |
public static const CLIENT_KILL_CONNECT:String = CLIENT_KILL_CONNECT
Since : | Reactor 1.0.0 |
An event triggered when the client closes an active connection. The ConnectionManagerEvent.CLIENT_KILL_CONNECT event is always followed by the ConnectionManagerEvent.DISCONNECT event.
See also
CONNECT_FAILURE | Constant |
public static const CONNECT_FAILURE:String = CONNECT_FAILURE
Since : | Reactor 1.0.0 |
An event triggered when a connection attempt by the ConnectionManager fails. Common causes of connection failures are:
The ConnectionManagerEvent.CONNECT_FAILURE event is triggered by the ConnectionManager class when the ConnectionManager has attempted to connect using all of the connections in its connection list, and none of them successfully achieved a "ready" state. As a convenience, when a connection attempt fails, the Reactor object also dispatches a ReactorEvent.CLOSE event.
See also
CONNECTION_STATE_CHANGE | Constant |
public static const CONNECTION_STATE_CHANGE:String = CONNECTION_STATE_CHANGE
Since : | Reactor 2.1.1 |
An event triggered when the ConnectionManager's state changes (e.g., from "CONNECTION_IN_PROGRESS" to "READY"). For a list of possible states, see the ConnectionState class.
The following example code registers for the CONNECTION_STATE_CHANGE event, and displays the ConnectionManager's new connection state in the output console.
// Event registration reactor.getConnectionManager().addEventListener( ConnectionManagerEvent.CONNECTION_STATE_CHANGE, connectionStateChangeListener); // Event listener definition function connectionStateChangeListener (e:ConnectionManagerEvent):void { trace("New connection state: " + getStateName(ConnectionManager(e.target).getConnectionState())); } // Helper function to translate numeric state codes to human-readable strings function getStateName (state:int):String { switch (state) { case -1: return "UNKNOWN"; case 0: return "NOT_CONNECTED"; case 1: return "READY"; case 2: return "CONNECTION_IN_PROGRESS"; case 3: return "DISCONNECTION_IN_PROGRESS"; case 4: return "LOGGED_IN"; default: return "UNRECOGNIZED STATE"; } }
See also
DISCONNECT | Constant |
public static const DISCONNECT:String = DISCONNECT
Since : | Reactor 1.0.0 |
An event triggered when either the client or the server closes an active connection. The ConnectionManagerEvent.DISCONNECT is always preceded by either the ConnectionManagerEvent.CLIENT_KILL_CONNECT event or the ConnectionManagerEvent.SERVER_KILL_CONNECT, which indicate whether the client or the server instigated the disconnection.
READY | Constant |
public static const READY:String = READY
Since : | Reactor 1.0.0 |
An event triggered when one of the IConnection objects in the ConnectionManager's connection list achieves a READY state. As a convenience, the ConnectionManagerEvent.READY event, in turn, always triggers a ReactorEvent.READY event. To retrieve a reference to the underlying IConnection object that achieved the ready state, use ConnectionManager's getActiveConnection() method.
See also
SELECT_CONNECTION | Constant |
public static const SELECT_CONNECTION:String = SELECT_CONNECTION
Since : | Reactor 1.0.0 |
An event triggered when the ConnectionManager selects an IConnection object for a connection attempt. Immediately after selecting the connection, the ConnectionManager attempts to connect it. Next, that individual IConnection object dispatches its own ConnectionEvent events indicating whether it was able to connect to Union. If the individual IConnection object cannot connect, the ConnectionManager automatically moves to the next available IConnection object. If any of the IConnection objects in the ConnectionManager's list successfully connects, then ConnectionManager triggers a ConnectionManagerEvent.READY event. If, on the other hand, none of the IConnection objects connects, the ConnectionManager triggers a ConnectionManagerEvent.CONNECT_FAILURE event, indicating that it could not establish a connection via any of the IConnection objects in its list.
To add a new IConnection object to the ConnectionManager's connection list, use ConnectionManager's addConnection() method.
See also
SERVER_KILL_CONNECT | Constant |
public static const SERVER_KILL_CONNECT:String = SERVER_KILL_CONNECT
Since : | Reactor 1.0.0 |
An event triggered when the server closes an active connection. The ConnectionManagerEvent.SERVER_KILL_CONNECT event is always followed by the ConnectionManagerEvent.DISCONNECT event.
See also