Constructor
# new LiveDataManager(mapsindoorsInstance)
LiveDataManager for receiving MapsIndoors live data.
Parameters:
Name | Type | Description |
---|---|---|
mapsindoorsInstance |
object
|
Instance of MapsIndoors |
Example
const liveDataManager = new mapsindoors.LiveDataManager(mapsIndoorsInstance);
Classes
Members
Object
# static readonly LiveDataManager.LiveDataDomainTypes
LiveDataDomainTypes
Properties:
Name | Type | Description |
---|---|---|
OCCUPANCY |
string
|
|
AVAILABILITY |
string
|
|
POSITION |
string
|
|
TEMPERATURE |
string
|
|
CO2 |
string
|
|
HUMIDITY |
string
|
|
COUNT |
string
|
Object
# static constant SubscriptionClientStates
SubscriptionClientStates
Properties:
Name | Type | Description |
---|---|---|
DISCONNECTED |
string
|
|
CONNECTED |
string
|
|
CONNECTING |
string
|
Methods
# async disableLiveData(domainType)
Disable livedata on the map for a livedata domain type.
Parameters:
Name | Type | Description |
---|---|---|
domainType |
string
|
The livedata domain type. |
Example
liveDataManager.disableLiveData(mapsindoors.LiveDataManager.LiveDataDomainTypes.OCCUPANCY);
# async enableLiveData(domainType, callbackopt)
Enable livedata on the map for a livedata domain type.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
domainType |
string
|
The livedata domain type. | |
callback |
function
|
<optional> |
This callback will be triggered whenever live updates for locations currently in the map are received. If omitted, the default behaviour is to apply badges to the location icons depicting the livedata value. |
Example
liveDataManager.enableLiveData(mapsindoors.LiveDataManager.LiveDataDomainTypes.OCCUPANCY);
# async getLiveUpdate(id, domainType) → {object}
Get live update for a domain type on a location.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
The location id |
domainType |
string
|
The update domain type to get |
object
# async subscribe(subscriptionTopic) → {Promise}
Subscribe to a Live Data topic.
Parameters:
Name | Type | Description |
---|---|---|
subscriptionTopic |
string
|
The topic to subscribe to. |
- Resolves if subscribed, rejects with error if not.
Promise
# async unsubscribe(subscriptionTopic) → {Promise}
Unsubscribe to a Live Data topic.
Parameters:
Name | Type | Description |
---|---|---|
subscriptionTopic |
string
|
The topic to unsubscribe. |
- Resolves if unsubscribed, rejects with error if not.
Promise
Events
# live_data_error
This event will fire if the live data connection encounters an error.
Properties:
Name | Type | Description |
---|---|---|
error |
object
|
# live_data_status_changed
This event will fire when the connection status changes.
Properties:
Type | Description |
---|---|
string
|
One of SubscriptionClientStates |
# live_update_received
This event will fire when a live update message is received.
Properties:
Name | Type | Description |
---|---|---|
update |
LiveUpdate
|