The connect()
method attempts to connect to Union Server at the specified host and
ports. If no host and ports are specified, Orbiter attempts to connect using the
ConnectionManager's current list of hosts and ports.
When a connection succeeds and the Orbiter object has been fully initialized, a OrbiterEvent.READY event is triggered. A OrbiterEvent.READY listener typically starts the application in motion, often by creating or joining rooms. Lower-level connection events can be handled via the application's ConnectionManager.
The string name or IP address of the domain on which Union Server is running. For more details, see the connect() method.
A list of integer ports over which Orbiter should attempt to connect to
Union Server. Orbiter will attempt to connect over the ports in the order
specified. For example, if ports
is set to 9100, 80, 443
, then Orbiter
will first attempt to connect to Union over port 9100; if the connection
fails, Orbiter will automatically next attempt to connect over port 80, if
that fails, Orbiter will attempt to connect to port 443. To add multiple
hosts (not just multiple ports) to Orbiter's list of failover connections,
use ConnectionManager.addConnection method. Wherever possible, to allow
maximum connection success by Union clients, Union Server should be run on
port 80.
Instructs Orbiter to use persistent socket connections only when attempting to connect to specified hosts and ports. When HTTP failover is disabled, Orbiter does not automatically attempt to establish backup HTTP connections if all persistent socket connection attempts fail.
Disables statistics tracking for this Orbiter object.
Terminates any open connection to the server. If the disconnection attempt succeeds, ConnectionManager dispatches the ConnectionManagerEvent.CLIENT_KILL_CONNECT and ConnectionManagerEvent.DISCONNECT events, and the Orbiter object dispatches a OrbiterEvent.CLOSE event.
The Orbiter class's disconnect() method is a convenience wrapper for the ConnectionManager.disconnect method.
Permanently disables this object and releases all of its resources. Once dispose()
is
called, the object can never be used again. Use dispose()
only when purging an object
from memory, as is required when unloading an iframe. To simply disconnect an Orbiter
object, use disconnect()
.
Instructs Orbiter to automatically try connecting via HTTP when it is unable to establish a persistent socket connection over all specified hosts and ports. HTTP failover is enabled by default. HTTP connections are less responsive than persistent socket connections, but have a higher chance of connecting from behind a firewall. For the most granular control over connection sequence, type, hosts, and ports, use the ConnectionManager class directly.
Enables statistics tracking for this Orbiter object. To retrieve statistics, use the getStatistics() method.
Returns a reference to the application's AccountManager instance, which is automatically created by Orbiter; the AccountManager class provides a set of services relating to registering and logging-in user accounts. For complete details see the main class entry for the AccountManager class.
Returns a reference to the application's ClientManager instance, which is automatically created by Orbiter; the ClientManager class creates and provides access to Client instances. Client instances store information about clients on the server, including client attributes, IP address, ping time, and connection time. For complete details see the main class entry for the ClientManager class.
Returns a reference to the application's ConnectionManager instance, which is automatically created by Orbiter; the ConnectionManager class is used to establish a connection to the server. For complete details see the main class entry for the ConnectionManager class.
Returns a reference to the application's ConnectionMonitor instance, which manages heartbeat (ping) and automatic disconnection and reconnection services.
Returns a reference to the application debugging log, which describes operations occurring on the client, and can show low-level client/server communications.
Returns a reference to the application's MessageManager instance, which is automatically created by Orbiter; the MessageManager class provides a set of services relating to sending messages to and receiving messages from the server. For complete details see the main class entry for the MessageManager class.
Returns a reference to the application's RoomManager, which is created automatically by Orbiter; the RoomManager class is used to create, destroy, observe, join, and access rooms.
Returns a reference to the application's Server instance, which is automatically created by Orbiter; the Server class provides access to global server data and functions. For complete details see the main class entry for the Server class.
The Union session ID for this Orbiter instance, if available.
Returns a reference to a Statistics object for this connection, which provides metrics such as KB/second transfer rate and number of messages sent and received.
Due to the performance cost associated with statistics tracking, the returned Statistics object returned by getStatistics() is disabled by default, and provides no data. To enable statistics tracking, invoke the Orbiter class's enableStatistics() method.
Returns a reference to the application's System class, whose static variables provide Orbiter version information.
Indicates whether Orbiter will automatically try connecting via HTTP when it is unable to establish a persistent socket connection over all specified hosts and ports.
Returns a Boolean indicating whether Orbiter currently has an active, fully initialized connection to the server.
true if the client is in a ready state; false otherwise.
Loads the client-configuration file. When the file load completes, Orbiter automatically attempts to connect to Union Server using the settings specified by the configuration file.
The configuration file has the following format:
<?xml version="1.0"?>
<config>
<connections>
<connection host="hostNameOrIP1" port="portNumber1" type="connectionType1" senddelay="milliseconds1" secure="false" />
<connection host="hostNameOrIPn" port="portNumbern" type="connectionTypen" senddelay="millisecondsn" secure="false" />
</connections>
<autoreconnectfrequency>frequency</autoreconnectfrequency>
<connectiontimeout>duration</connectiontimeout>
<heartbeatfrequency>frequency</heartbeatfrequency>
<readytimeout>timeout</readytimeout>
<loglevel>level</loglevel>
</config>
When the secure
attribute is true, communication is conducted over WSS or HTTPS using
the environment's TLS implementation.
The secureConnect()
method is identical to the connect()
method, except that it uses
an encrypted connection (TLS or SSL) rather than an unencrypted connection. Before
secureConnect()
can be used, Union Server must be configured to accept client
communications over a secure gateway, which includes the installation of a server-side
security certificate.
Returns a reference to the application's own Client object (i.e., the "current client").
Specifies the host and port for future connection attempts. The setServer() method does not attempt to open a new connection; to connect after specifying the server, use Orbiter's connect() method.
The string name or IP address of the domain on which Union Server is running. For more details, see the connect() method.
A list of integer ports over which Orbiter should attempt to connect to Union Server.
The Orbiter class is the root class of every Orbiter client application. It provides basic tools for connecting to Union server, and gives the application access to the core Orbiter system modules, including: