Packagenet.user1.reactor
Interfacepublic interface IConnection extends IEventDispatcher
Implementors Connection

Since : Reactor 1.0.0

IConnection is the interface that all connection classes must implement in order to connect to Union. Connection classes are provided by the Reactor SDK, and are managed by the ConnectionManager.

To make a new connection to Union server, use Reactor's connect() method or ConnectionManager's connect() method.

See also

HTTPConnection
XMLSocketConnection
Connection
ConnectionManager


Public Methods
 MethodDefined By
  
connect():void
Attempts to connect to Union Server at the current host and port.
IConnection
  
disconnect():void
Closes the connection to Union Server.
IConnection
  
dispose():void
Permanently disables the connection object.
IConnection
  
getHost():String
Returns the host on which the connection will be opened or has been opened.
IConnection
  
getPort():int
Returns the port on which the connection will be opened or has been opened.
IConnection
  
Returns the host that was requested for this connection via setServer().
IConnection
  
getType():String
Returns the type of the connection, as one of the types specified by the ConnectionType class.
IConnection
  
isReady():Boolean
Indicates whether this connection is currently in a "ready" state.
IConnection
  
isValid():Boolean
Indicates whether this connection is considered valid.
IConnection
  
send(data:*):void
Sends the specified data to Union Server.
IConnection
  
setReactor(reactor:Reactor):void
Assigns the Reactor object for which this IConnection will provide server communication services.
IConnection
  
setServer(host:String, port:int):void
Assigns the host and port to use with the connect() method.
IConnection
  
toString():String
Provides a string representation of this object.
IConnection
Method Descriptions
connect()method
public function connect():void

Since : Reactor 1.0.0

Attempts to connect to Union Server at the current host and port. The result of the attempt is reported via ConnectionEvent.READY and ConnectionEvent.CONNECT_FAILURE events. The connect() method is not normally intended for direct use. Connections to the server should instead be made via the Reactor or ConnectionManager classes.

disconnect()method 
public function disconnect():void

Since : Reactor 1.0.0

Closes the connection to Union Server. The disconnect() method is not normally intended for direct use. Disconnections from the server should instead be requested via the Reactor or ConnectionManager classes.

dispose()method 
public function dispose():void

Since : Reactor 1.0.0

Permanently disables the connection object.

getHost()method 
public function getHost():String

Since : Reactor 1.0.0

Returns the host on which the connection will be opened or has been opened.

Returns
String — The host name or ip, as a string. For example, "example.com" or "192.168.0.1".
getPort()method 
public function getPort():int

Since : Reactor 1.0.0

Returns the port on which the connection will be opened or has been opened.

Returns
int — A number from 1 to 65535.
getRequestedHost()method 
public function getRequestedHost():String

Since : Reactor 1.0.0

Returns the host that was requested for this connection via setServer(). If that host is a load balancing DNS server, the actual host used for the connection (as returned by getHost()) might differ from the requested host.

Returns
String — The requested host name or ip, as a string. For example, "example.com" or "192.168.0.1".
getType()method 
public function getType():String

Since : Reactor 1.0.0

Returns the type of the connection, as one of the types specified by the ConnectionType class.

Returns
String — A string representing the connection type.

See also

isReady()method 
public function isReady():Boolean

Since : Reactor 1.0.0

Indicates whether this connection is currently in a "ready" state.

Returns
Boolean
isValid()method 
public function isValid():Boolean

Since : Reactor 1.0.0

Indicates whether this connection is considered valid. Valid connections are those that are currently in a "ready" state, or are currently disconnected but successfully achieved a "ready" state in the most recent connection attempt.

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

Since : Reactor 1.0.0

Sends the specified data to Union Server. The send() method is not intended for direct use. Data should be sent to the server via the Reactor API. See the MessageManager, Room, RoomManager, Client, ClientManager, and Server classes. To access the raw strings sent via the send() method, register for the ConnectionEvent.SEND_DATA event.

Parameters

data:*

See also

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

Since : Reactor 1.0.0.

Assigns the Reactor object for which this IConnection will provide server communication services. This method is invoked automatically by the ConnectionManager when the IConnection object is added to the ConnectionManager's connection list.

Parameters

reactor:Reactor — A Reactor instance.

See also

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

Since : Reactor 1.0.0.

Assigns the host and port to use with the connect() method.

Parameters

host:String — The server address (typically an IP address or domain name).
 
port:int — A port number between 1 and 65536. Note that ports from 1-7 are normally reserved for use by the operating system, and should therefore not be used by Reactor applications.

See also

toString()method 
public function toString():String

Since : Reactor 1.0.0

Provides a string representation of this object.

Returns
String