Members
(static) instance
- Description:
Return the singleton instance of the client node.
- Source:
Return the singleton instance of the client node.
Methods
(async) callService(serviceRequest)
- Description:
Make a service call.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
serviceRequest |
ubii.services.ServiceRequest | Protobuf of a service request. https://github.com/SandroWeber/ubii-msg-formats/blob/develop/src/proto/services/serviceRequest.proto |
Returns:
A Ubi-Interact ServiceReply. https://github.com/SandroWeber/ubii-msg-formats/blob/develop/src/proto/services/serviceReply.proto
(async) connect(urlServices, urlTopicData)
- Description:
Connect to master node.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
urlServices |
string | URL for service calls. |
urlTopicData |
string | URL for websocket connection transferring TopicData. |
Returns:
A promise that resolves when connected or rejects on failure to connect.
(async) deregisterDevice(deviceSpecs)
- Description:
Deregister the specified device. Usually enough to fill in the device's ID.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
deviceSpecs |
ubii.devices.Device | Protobuf object specifying device. https://github.com/SandroWeber/ubii-msg-formats/blob/develop/src/proto/devices/device.proto |
Returns:
The master node reply for the requested deregistration.
(async) disconnect()
- Description:
Disconnect from master node.
- Source:
Returns:
A promise indicating conclusion.
generateTimestamp() → {ubii.topicData.Timestamp}
- Description:
Create a new timestamp to be included in a TopicDataRecord using the current system time in milliseconds.
- Source:
Returns:
The timestamp. https://github.com/SandroWeber/ubii-msg-formats/blob/develop/src/proto/topicData/timestamp.proto
- Type
- ubii.topicData.Timestamp
getClientID()
- Description:
Get the client node ID if connected, or undefined if not connected.
- Source:
Returns:
A string, or undefined.
getPublishIntervalMs()
- Description:
Get the interval used to regularly publish TopicDataRecords.
- Source:
Returns:
Interval in milliseconds.
getUUIDv4Regex() → {String}
- Description:
Get a regular expression matching UUIDv4 strings.
- Source:
Returns:
The regular expression.
- Type
- String
isConnected()
- Description:
Whether the client node is connected to the master node or not.
- Source:
Returns:
A boolean.
onDisconnect(callback)
- Description:
Add a callback function to be executed after disconnecting.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | A callback function. |
publishRecord(topicDataRecord)
- Description:
Add a TopicDataRecord to the publishing queue.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
topicDataRecord |
ubii.topicData.TopicDataRecord | TopicDataRecord to publish. https://github.com/SandroWeber/ubii-msg-formats/blob/develop/src/proto/topicData/topicDataRecord.proto |
publishRecordImmediately(topicDataRecord)
- Description:
Publish a TopicDataRecord without delay using an individual TopicData message instead of queueing it. Might lead to messaging overhead.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
topicDataRecord |
ubii.topicData.TopicDataRecord | TopicDataRecord to publish. https://github.com/SandroWeber/ubii-msg-formats/blob/develop/src/proto/topicData/topicDataRecord.proto |
publishRecordList(topicDataRecordList)
- Description:
Add a list of TopicDataRecords to the publishing queue.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
topicDataRecordList |
ubii.topicData.TopicDataRecordList | TopicDataRecordList to publish. https://github.com/SandroWeber/ubii-msg-formats/blob/develop/src/proto/topicData/topicDataRecord.proto |
(async) reconnect()
- Description:
Reconnect to master node.
- Source:
(async) registerDevice(deviceSpecs)
- Description:
Register the specified device.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
deviceSpecs |
ubii.devices.Device | Protobuf object specifying device. https://github.com/SandroWeber/ubii-msg-formats/blob/develop/src/proto/devices/device.proto |
Returns:
The master node reply for the requested registration.
(async) registerSession(sessionSpecs)
- Description:
Register the specified session.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
sessionSpecs |
ubii.sessions.Session | Protobuf object specifying session. https://github.com/SandroWeber/ubii-msg-formats/blob/develop/src/proto/sessions/session.proto |
Returns:
The master node reply for the requested registration.
setHTTPS(bool)
- Description:
Set whether to use HTTPS or not when trying to connect to master node.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
bool |
boolean |
setName(name)
- Description:
Set a name to use for the client node.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name. |
setPublishIntervalMs(intervalMs)
- Description:
Set the interval used to regularly publish TopicDataRecords.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
intervalMs |
Number | Interval in milliseconds. |
(async) subscribeComponents(componentProfile, callback)
- Description:
Subscribe to a component profile, providing a callback function to be called upon receiving notifications.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
componentProfile |
ubii.devices.Component | The Component(s) to subscribe to. Used to match against existing and future Components. https://github.com/SandroWeber/ubii-msg-formats/blob/develop/src/proto/devices/component.proto |
callback |
function | The function to be called upon receiving messages for the specified Component profile. |
Returns:
A subscription token that should be used to unsubscribe.
subscribeRegex(regex, callback)
- Description:
Subscribe to a regular expression, providing a callback function to be called upon receiving notifications.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
regex |
String | The regular expression to subscribe to. Used to match against existing and future topics. |
callback |
function | The function to be called upon receiving messages for the specified regular expression. |
Returns:
A subscription token that should be used to unsubscribe.
(async) subscribeTopic(topic, callback)
- Description:
Subscribe to a topic, providing a callback function to be called upon receiving notifications.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
topic |
String | The topic to subscribe to. |
callback |
function | The function to be called upon receiving messages for the specified topic. |
Returns:
A subscription token that should be used to unsubscribe.
(async) unsubscribe(token)
- Description:
Unsubscribe using a subscription token.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
token |
Object | The token returned by one of the subscribe... methods. |
Returns:
The master node reply.
waitForConnection()
- Description:
Use to receive a Promise that resolves as soon as connection is established.
- Source:
Returns:
The Promise.