Create a new CascadeDriver instance
the available subtransports
the connection options
a list of available transport names
an emitter for emitting events on the Transports stream
An emitter for emitting events on the Transports stream
The emitter for emitting data, close, and error events
The name of the transport
The handshake error handler
The handshake handler
A list of remaining transport names to try
The connection request.
A flag indicating whether a response has been received
The current transport object.
A factory function for creating transports
A list of available transport names
Cascade to the next available transport
A close event may be emitted on this stream and a cascade event is
emitted on the Transports stream.
If there are no more transports a transports-exhausted event is emitted
on the Transports stream.
a flag indicating whether a close event should be
suppressed
true if attempting to connect, false if transports exhausted
Close the transport
this stream
Close the current transport quietly, without generating any events.
Connect using the available transports
the connection request.
the handshake handler
the handshake error handler
Send a binary message to the server.
the message to send
Connect to the current transport
A cascading-connect event is emitted on the Transports stream.
true if attempting to connect
Remove a listener from a specified event.
Example:
// Bind a single listener to the 'foo' event and then deregister it
var listener = function() {};
stream.on('foo', listener);
stream.off('foo', listener);
Example:
// Bind a listener to the 'foo' event and deregister all listeners
var listener = function() {};
stream.on('foo', listener);
stream.off('foo');
the listener to remove. All listeners for the event are removed if this is not specified. This argument is ignored if the first argument is a CallbackMap.
this stream.
Register listeners against events.
A single listener may be bound to an event by passing the event name and listener function.
Multiple listeners may be bound by passing in a CallbackMap, mapping event names to listener functions.
Example:
// Bind a single listener to the 'foo' event
stream.on('foo', function(arg1, arg2) {
console.log("Called for 'foo' event", arg1, arg2);
});
Example:
// Bind multiple listeners
stream.on({
foo : function() { ... },
bar : function() { ... },
baz : function() { ... }
});
It is possible to bind multiple listeners to the same event. In this case, the listeners will be called in the order they were bound.
the event name or CallbackMap mapping event names to listeners
the listener to bind to the event, if passed as string. This argument is ignored if the first argument is a CallbackMap.
this stream.
Called when the transport emits a close event.
Only emits a close event on this stream if it can't cascade further
the reason for closing
Called when the connection response is received.
the connection response from the server
Called when the transport emits a data event.
Forwards the data and emits a data on this stream
the message data
Called when the transport emits an error event.
Forwards the data and emits a error on this stream
the error that occurred
Called when the connection response cannot be parsed.
the error that occurred
Select and create the next enabled transport.
the selected transport, or null if transports exhausted
Copyright © 2025 DiffusionData Ltd. All Rights Reserved.
Encapsulate the set of available transport mechanisms and expose them in an implementation independent manner.