The top-level Diffusion API.
Provides access to Session connections and global namespaces.
Properties:
Name | Type | Description |
---|---|---|
version |
String | The version of this client library in the form major.minor.patch |
topics |
diffusion.topics | Access to the topics namespace. |
clients |
diffusion.clients | Access to PropertyKeys. |
metadata |
diffusion.metadata | Access to the metadata namespace. |
selectors |
diffusion.selectors | Access to the selectors namespace. |
datatypes |
diffusion.datatypes | Access to the datatypes namespace. |
errorReport |
ErrorReport | Access to the ErrorReport class. |
Namespaces
Methods
-
connect(options) → {Result.<Session>}
-
Connect to a specified Diffusion server. This will return a Result that will complete succesfully if a session can be connected, or fail if an error was encountered.
If the result is succesful, the fulfilled handler will be called with a Session instance. This session will be in a connected state and may be used for subsequent API calls.
If the result fails, the rejected handler will be called with an error reason.
Parameters:
Name Type Argument Description options
Session.Options | String <optional>
The options to construct the session with. Returns:
Example
diffusion.connect('example.server.com').then(function(session) { // Connected with a session console.log('Connected!', session); }, function(error) { // Connection failed console.log('Failed to connect', error); });
-
log(level)
-
Set the level of logging used by Diffusion. This will default to silent. Log levels are strings that represent different degrees of information to be logged. Available options are:
- silent
- error
- warn
- info
- debug
Parameters:
Name Type Description level
String The log level to use.