Packagenet.user1.reactor
Classpublic class Connection
InheritanceConnection Inheritance flash.events.EventDispatcher
Implements IConnection
Subclasses HTTPConnection, SecureSocketConnection, XMLSocketConnection

Since : Reactor 1.0.0

The Connection is the base class of all Reactor connection classes, including XMLSocketConnection and HTTPConnection. It provides common functionality that is inherited by the Reactor connection classes, but it is not intended to be used directly by developers.

To make a new connection to Union server, use the Reactor or ConnectionManager classes.

See also

Reactor.connect()
ConnectionManager.connect()
XMLSocketConnection
HTTPConnection


Public Methods
 MethodDefined By
  
Connection(host:String, port:int, type:String)
Connection
  
connect():void
For documentation, see IConnection's connect() method.
Connection
  
disconnect():void
For documentation, see IConnection's disconnect() method.
Connection
  
dispose():void
For documentation, see IConnection's dispose() method.
Connection
  
getHost():String
For documentation, see IConnection's getHost() method.
Connection
  
getPort():int
For documentation, see IConnection's getPort() method.
Connection
  
Returns an integer indicating the number of times this Connection object has successfully achieved a ready state.
Connection
  
For documentation, see IConnection's getRequestedHost() method.
Connection
  
getType():String
For documentation, see IConnection's getType() method.
Connection
  
isReady():Boolean
For documentation, see IConnection's isReady() method.
Connection
  
isValid():Boolean
For documentation, see IConnection's isValid() method.
Connection
  
send(data:*):void
For documentation, see IConnection's send() method.
Connection
  
setReactor(reactor:Reactor):void
Connection
  
setServer(host:String, port:int):void
For documentation, see IConnection's setServer() method.
Connection
  
toString():String
[override]
Connection
Events
 Event Summary Defined By
   Dispatched when a connection attempt by an IConnection object begins.Connection
   Dispatched when an IConnection object initiates the "handshake" phase of a Union Server connection.Connection
   Dispatched when an IConnection object's connection to the server is closed by the client.Connection
   Dispatched when a connection attempt by an IConnection object fails.Connection
   Dispatched when an IConnection object achieves a fully initialized connection to the server.Connection
   Dispatched whenever any data is received from Union Server by an IConnection object.Connection
   Dispatched whenever any data is sent to Union Server over an IConnection object.Connection
   Dispatched when an IConnection object's connection to the server is closed by the server.Connection
   Dispatched when Union Server informs the client that a session id used in a message from the client refers to an unknown session.Connection
   Dispatched when Union Server informs the client that its session has been terminated.Connection
Constructor Description
Connection()Constructor
public function Connection(host:String, port:int, type:String)



Parameters
host:String
 
port:int
 
type:String
Method Descriptions
connect()method
public function connect():void

Since : Reactor 1.0.0

For documentation, see IConnection's connect() method.

See also

disconnect()method 
public function disconnect():void

Since : Reactor 1.0.0

For documentation, see IConnection's disconnect() method.

See also

dispose()method 
public function dispose():void

Since : Reactor 1.0.0

For documentation, see IConnection's dispose() method.

See also

getHost()method 
public function getHost():String

Since : Reactor 1.0.0

For documentation, see IConnection's getHost() method.

Returns
String

See also

getPort()method 
public function getPort():int

Since : Reactor 1.0.0

For documentation, see IConnection's getPort() method.

Returns
int

See also

getReadyCount()method 
public function getReadyCount():int

Since : Reactor 1.0.0

Returns an integer indicating the number of times this Connection object has successfully achieved a ready state.

Returns
int
getRequestedHost()method 
public function getRequestedHost():String

Since : Reactor 2.0.0

For documentation, see IConnection's getRequestedHost() method.

Returns
String

See also

getType()method 
public function getType():String

Since : Reactor 1.0.0

For documentation, see IConnection's getType() method.

Returns
String

See also

isReady()method 
public function isReady():Boolean

Since : Reactor 1.0.0

For documentation, see IConnection's isReady() method.

Returns
Boolean

See also

isValid()method 
public function isValid():Boolean

Since : Reactor 1.0.0

For documentation, see IConnection's isValid() method.

Returns
Boolean

See also

send()method 
public function send(data:*):void

Since : Reactor 1.0.0

For documentation, see IConnection's send() method.

Parameters

data:*

See also

setReactor()method 
public function setReactor(reactor:Reactor):void

Parameters

reactor:Reactor

setServer()method 
public function setServer(host:String, port:int):void

Since : Reactor 1.0.0

For documentation, see IConnection's setServer() method.

Parameters

host:String
 
port:int

See also

toString()method 
override public function toString():String

Returns
String
Event Detail
BEGIN_CONNECT Event
Event Object Type: ConnectionEvent
ConnectionEvent.type variable = net.user1.reactor.ConnectionEvent.BEGIN_CONNECT

Dispatched when a connection attempt by an IConnection object begins. The ConnectionEvent.BEGIN_CONNECT event is followed by either a ConnectionEvent.BEGIN_HANDSHAKE event or a ConnectionEvent.CONNECT_FAILURE event. It indicates that the individual IConnection object has started an attempt to connect to Union Server.

See also

BEGIN_HANDSHAKE Event  
Event Object Type: ConnectionEvent
ConnectionEvent.type variable = net.user1.reactor.ConnectionEvent.BEGIN_HANDSHAKE

Dispatched when an IConnection object initiates the "handshake" phase of a Union Server connection. During the handshake phase, the connection identifies the client to the server by sending a CLIENT_HELLO UPC message, and then waits for the server's response. If the connection is successfully initialized, the ConnectionEvent.READY event will follow. If not, the ConnectionEvent.CONNECT_FAILURE event will follow.

See also

CLIENT_KILL_CONNECT Event  
Event Object Type: ConnectionEvent
ConnectionEvent.type variable = net.user1.reactor.ConnectionEvent.CLIENT_KILL_CONNECT

Dispatched when an IConnection object's connection to the server is closed by the client. The ConnectionEvent.CLIENT_KILL_CONNECT event is always followed by the ConnectionEvent.DISCONNECT event.

See also

CONNECT_FAILURE Event  
Event Object Type: ConnectionEvent
ConnectionEvent.type variable = net.user1.reactor.ConnectionEvent.CONNECT_FAILURE

Dispatched when a connection attempt by an IConnection object fails. Common causes of connection failures are:

See also

READY Event  
Event Object Type: ConnectionEvent
ConnectionEvent.type variable = net.user1.reactor.ConnectionEvent.READY

Dispatched when an IConnection object achieves a fully initialized connection to the server. As a convenience, the ConnectionEvent.READY event, in turn, triggers a ConnectionManagerEvent.READY event, which triggers a ReactorEvent.READY event.

See also

RECEIVE_DATA Event  
Event Object Type: ConnectionEvent
ConnectionEvent.type variable = net.user1.reactor.ConnectionEvent.RECEIVE_DATA

Dispatched whenever any data is received from Union Server by an IConnection object.

See also

SEND_DATA Event  
Event Object Type: ConnectionEvent
ConnectionEvent.type variable = net.user1.reactor.ConnectionEvent.SEND_DATA

Dispatched whenever any data is sent to Union Server over an IConnection object.

See also

SERVER_KILL_CONNECT Event  
Event Object Type: ConnectionEvent
ConnectionEvent.type variable = net.user1.reactor.ConnectionEvent.SERVER_KILL_CONNECT

Dispatched when an IConnection object's connection to the server is closed by the server. The ConnectionEvent.SERVER_KILL_CONNECT event is always followed by the ConnectionEvent.DISCONNECT event.

See also

SESSION_NOT_FOUND Event  
Event Object Type: ConnectionEvent
ConnectionEvent.type variable = net.user1.reactor.ConnectionEvent.SESSION_NOT_FOUND

Dispatched when Union Server informs the client that a session id used in a message from the client refers to an unknown session.

See also

SESSION_TERMINATED Event  
Event Object Type: ConnectionEvent
ConnectionEvent.type variable = net.user1.reactor.ConnectionEvent.SESSION_TERMINATED

Dispatched when Union Server informs the client that its session has been terminated.

See also