ConnectionManager

ConnectionManager

Methods

attach(connector, optsopt) → {Promise}

Source:
Attach a device protocol connector to this manager for managing device connectivity.
Parameters:
Name Type Attributes Description
connector ConnectorInterface
opts Object <optional>
Properties
Name Type Attributes Default Description
autoconnect boolean <optional>
true Automatically connect
reconnect boolean <optional>
true Enable/Disable auto-reconnects
Returns:
Type
Promise

connect(uid) → {MessageChannel}

Source:
Parameters:
Name Type Description
uid string
Returns:
Type
MessageChannel

detach(uid, optsopt) → {Promise}

Source:
Detach a device protocol connector from this manager and disconnect from the device if it's connected.
Parameters:
Name Type Attributes Description
uid string
opts Object <optional>
Properties
Name Type Attributes Default Description
disconnect boolean <optional>
true
Returns:
Type
Promise

disconnect(uid) → {boolean}

Source:
Parameters:
Name Type Description
uid string
Returns:
Type
boolean

Events

attached

Source:
Properties:
Name Type Description
uid string
Emitted when a new connector has been attached to this instance

connected

Source:
Properties:
Name Type Description
uid string
channel Channel
Emitted when a device has connected.

connecting

Source:
Properties:
Name Type Description
uid string
Emitted when a connector has began connecting to a remote device.

detached

Source:
Properties:
Name Type Description
uid string
Emitted when a connector has been detached from this instance.

disconnected

Source:
Properties:
Name Type Description
uid string
Emitted when a device has disconnected.

error

Source:
Properties:
Name Type Description
error Error
Emitted when an error has occured