Packagecom.electrotank.electroserver5.connection
Classpublic class Connection
InheritanceConnection Inheritance flash.events.EventDispatcher
Subclasses HttpConnection, RtmpConnection, SocketConnection, UdpConnection

This is the base class for all connections. Other classes such as SocketConnection and HttpConnection subclass this. It provides the minimum common functionality between the conneciton types, which isn't much.



Public Properties
 PropertyDefined By
  connected : Boolean
Gets or set the connected propert
Connection
  connectionId : int
Gets or sets the connection id.
Connection
  encryptionContext : DhAesEncryptionContext
Connection
  hashId : int
Hash id used for password encryption
Connection
  host : String
[read-only] Returns the host name of the connection.
Connection
  isPrimaryCapable : Boolean
Gets or sets the isPrimaryCapable property.
Connection
  outboundId : Number
[read-only] Returns the outboundId for the last message sent.
Connection
  port : int
[read-only] Returns the port used for the connection.
Connection
  serverId : String
[read-only] Gets the id of the server this connection is associated with.
Connection
  serverVersion : String
Full version number of the ES5 server
Connection
  transportType : String
[read-only] Gets the type of connection this is.
Connection
Public Methods
 MethodDefined By
  
Connection(availableConnection:AvailableConnection)
Creates a new instance.
Connection
  
close():void
Closes the established connection.
Connection
  
connect():void
Uses the connection information to attempt to establish a connection.
Connection
  
Decrements the outbound id.
Connection
  
Gets the next outbound id by incrementing the current outboundId.
Connection
  
send(data:ByteArray):void
Sends binary data over the established connection.
Connection
Property Detail
connectedproperty
connected:Boolean

Gets or set the connected propert


Implementation
    public function get connected():Boolean
    public function set connected(value:Boolean):void
connectionIdproperty 
connectionId:int

Gets or sets the connection id.


Implementation
    public function get connectionId():int
    public function set connectionId(value:int):void
encryptionContextproperty 
encryptionContext:DhAesEncryptionContext


Implementation
    public function get encryptionContext():DhAesEncryptionContext
    public function set encryptionContext(value:DhAesEncryptionContext):void
hashIdproperty 
hashId:int

Hash id used for password encryption


Implementation
    public function get hashId():int
    public function set hashId(value:int):void
hostproperty 
host:String  [read-only]

Returns the host name of the connection.


Implementation
    public function get host():String
isPrimaryCapableproperty 
isPrimaryCapable:Boolean

Gets or sets the isPrimaryCapable property. If true, then this connection is capable of being the only connection.


Implementation
    public function get isPrimaryCapable():Boolean
    public function set isPrimaryCapable(value:Boolean):void
outboundIdproperty 
outboundId:Number  [read-only]

Returns the outboundId for the last message sent.


Implementation
    public function get outboundId():Number
portproperty 
port:int  [read-only]

Returns the port used for the connection.


Implementation
    public function get port():int
serverIdproperty 
serverId:String  [read-only]

Gets the id of the server this connection is associated with.


Implementation
    public function get serverId():String
serverVersionproperty 
serverVersion:String

Full version number of the ES5 server


Implementation
    public function get serverVersion():String
    public function set serverVersion(value:String):void
transportTypeproperty 
transportType:String  [read-only]

Gets the type of connection this is. The value is one of the values found in the TransportType class.


Implementation
    public function get transportType():String
Constructor Detail
Connection()Constructor
public function Connection(availableConnection:AvailableConnection)

Creates a new instance. Using the AvailableConnection instance passed in it sets the host, port, transport type, and server id as properties on this class.

Parameters
availableConnection:AvailableConnection — instance which holds the needed connection information.
Method Detail
close()method
public function close():void

Closes the established connection. This method needs to be overriden in each subclass.

connect()method 
public function connect():void

Uses the connection information to attempt to establish a connection. This method needs to be overridden in each subclass.

decrementOutboundId()method 
public function decrementOutboundId():void

Decrements the outbound id. For use by EsEngine only.

getNextOutboundId()method 
public function getNextOutboundId():Number

Gets the next outbound id by incrementing the current outboundId.

Returns
Number — The next outbound id.
send()method 
public function send(data:ByteArray):void

Sends binary data over the established connection. This method needs to be overriden in each subclass.

Parameters

data:ByteArray — data to send.