Module: plugins/polling-updater

Uses a SOAP endpoint in the cloud API to continuously poll for available updates.

The SOAP endpoint (/ethComet.asmx) is undocumented, but is the one used by the client web application. The difference to the client web application is that this implementation uses a proper SOAP API interface (in contrast to hand-building the XML to be transmitted, and to parsing the returned XML with a regex), and that it calls a different method at that endpoint.

This updater should receive updates resulting from armed sensors going below or above their configured thresholds, or detecting motion. The one caveat is that there is a short wait time (see UPDATE_LOOP_WAIT), and an exponentially increasing wait time after errors (see WAIT_AFTER_ERROR) until the next poll is issued. Updates falling into this time period will only be caught at the next regular update interval configured for a tag.

Source:

Classes

PollingTagUpdater

Members

(inner, constant) API_BASE_URI :string

the base URI of the polling API endpoint

Type:
  • string
Default Value:
  • https://www.mytaglist.com
Source:

(inner, constant) MAX_UPDATE_LOOP_WAIT :number

the maximum time to wait between subsequent calls of the polling endpoint (in milliseconds)

Type:
  • number
Source:

(inner, constant) UPDATE_LOOP_WAIT :number

the time to wait between subsequent calls of the polling endpoint (in milliseconds)

Type:
  • number
Default Value:
  • 10
Source:

(inner, constant) WAIT_AFTER_ERROR :number

the minimum time to wait between subsequent calls of the polling endpoint after an error occurred (in milliseconds)

Type:
  • number
Default Value:
  • 1000
Source:

(inner, constant) WSDL_URL_PATH :string

the path (relative to API_BASE_URI) of the WSDL endpoint description for polling

Type:
  • string
Default Value:
  • /ethComet.asmx?WSDL
Source:

Methods

(inner) createSoapClient(optsopt) → {Promise}

Creates the SOAP client, using the supplied options for locating the WSDL document for the endpoint.

Parameters:
Name Type Attributes Description
opts object <optional>

WSDL and SOAP endpoint options

Properties
Name Type Attributes Description
wsdl_url string <optional>

the URL from which to fetch the WSDL document; defaults to the concatenation of API_BASE_URI and WSDL_URL_PATH

Source:
Returns:

On success, resolves to the created SOAP client object

Type
Promise

(inner) pollForNextUpdate(client, tagManageropt, callbackopt) → {Promise}

Polls the API endpoint for available updates and returns them.

Parameters:
Name Type Attributes Description
client object

the SOAP client object

tagManager WirelessTagManager <optional>

the tag manager to which to restrict updates (this is currently ignored)

callback module:wirelesstags~apiCallback <optional>

if provided, the tagManager parameter must be provided too (even if as undefined or null)

Source:
Returns:

On success, resolves to an array of tag data objects

Type
Promise

(inner) updateTag(tag, tagData)

Updates the tag corresponding to the given tag data. Does nothing if the respective tag is undefined or null.

Parameters:
Name Type Description
tag WirelessTag

the tag object to be updated

tagData object

the data to update the tag object with; this is normally returned from the API endpoint

Source: