Copyright USER1 Subsystems Corporation
2016-3-9 21:32

Class net.user1.orbiter.HTTPDirectConnection

The HTTPDirectConnection class is used by Orbiter to communicate with Union Server over HTTP; it uses CORS to bypass cross-origin restrictions when Union Server is hosted on a domain that does not match the domain at which the Orbiter client is hosted. Normally, developers need not use the HTTPDirectConnection class directly, and should instead make connections via the Orbiter class's connect() method. However, the HTTPDirectConnection class is required for fine-grained connection configuration, such as defining failover connections for multiple Union Servers running at different host addresses.

By default, Orbiter uses the WebSocketConnection class, not the HTTPDirectConnection class, to communicate with Union Server. The HTTPDirectConnection class is used as a backup connection when the primary WebSocketConnection connection is blocked by a firewall. However, on a very heavily loaded server with limited persistent socket connections available, communicating with Union Server over HTTP--which uses short-lived socket connections--can improve performance at the expense of realtime responsiveness. To reduce server load when communicating over HTTP, use HTTPDirectConnection's setSendDelay() method to decrease the frequency of Orbiter's requests for updates from Union Server. Developers that wish to use HTTP connections as the primary form of communication with Union Server must do so by manually configuring connections via the ConnectionManager class's addConnection() method.

In environments that do not support CORS (such as IE8 on Windows), Orbiter conducts HTTP communications using HTTPIFrameConnection instead of HTTPDirectConnection.

For secure HTTP and WebSocket communications, see SecureHTTPDirectConnection, SecureHTTPIFrameConnection, and SecureWebSocketConnection.

For a list of events dispatched by HTTPDirectConnection, net.user1.orbiter.Connection.

Constructor