Check if the session is connected
If the session is not connected an error will be emitted on the session's stream
true if the finite state machine is in the connected state
Close the stream. This will emit a 'close' event to any assigned listeners. No further events will be emitted.
Attempt to connect to the server
Return the sesssion context
Get the conversation set
the conversation set
Get the session's options
the options
Get the session principal
the session principal
Get the topic routing instance
Get the server's maximum message size.
Get the session's service locator
a reference to the service locator
Get the service registry
a reference to the service registry
Get the session ID
the session ID
Get the current state
the state of the finite state machine
Get the stream registry
the stream registry
Query if the session is connected
true if the finite state machine is in the connected state
Query if the session is using a shared session
Request a session lock
the lock name
the lock scope
a Promise that resolves with the acquired session lock
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.
Handle system ping
Set the principal of the session
the new principal
Updates the session with missing features that may have been loaded asynchronously. This method only has an effect when running the client as a modular client in the browser.
Copyright © 2025 DiffusionData Ltd. All Rights Reserved.
Internal session interface
The following events are emitted:
transport-selected: a transport has been selected. Parameters:namethe transport namecascade: the transport is cascadingconnect: the session has established a connection to the server. ParametersessionIdthe session IDdisconnect: the session has been disconnected from the server. Parameter:reason: CloseReasonthe CloseReasonreconnect: the session has reconnected to the serverclose: the session is closed: Parameter:reason: CloseReasonthe CloseReasonerror: an error has occurred. Parametererrorthe error that has been raised