hi steve,
Most of the Reactor API is identical to the Orbiter API, but adding connections manually is one area where the two APIs differ slightly. Here's an example showing how to create a WebSocket connection to server1.com with a backup HTTP connection to server2.com. The server2.com connection will not be used unless the server1.com connection fails.
- Code: Select all
// Add a WebSocket connection explicitly
var connection1 = new net.user1.orbiter.WebSocketConnection("server1.com");
orbiter.getConnectionManager().addConnection(connection1);
// Add an HTTP connection explicitly
var connection2;
if (orbiter.getSystem().hasHTTPDirectConnection()) {
connection2 = new net.user1.orbiter.HTTPDirectConnection("server2.com", 80);
} else {
connection2 = new net.user1.orbiter.HTTPIFrameConnection("server2.com", 80);
}
orbiter.getConnectionManager().addConnection(connection2);
// Connect, starting with connection1
orbiter.connect();
Please let me know if you discover any other areas where the Reactor documentation can not be applied to Orbiter JavaScript development.
colin