Initialize a new GetStateService.
Service configuration.
Service logger.
Protected
_configSpecific service endpoint.
A path relative to the IServiceConfig.controllerUrl.
HTTP request method for this specific service endpoint.
See: axios/Method
Protected
_requestCustom HTTP headers.
Custom headers can be defined in form of a key value pair.
this._requestHeaders["Cache-Control"] = "no-cache";
The actual service data object.
Protected
logLogger which will be used for all logging events.
Protected
axiosGet an axios/AxiosRequestConfig
object.
Get the base url.
The IServiceConfig.controllerUrl string.
Get the webservice url (joined base url and endpoint).
URL string (joined base url and endpoint).
Recursive wrapper for the polling mechanism. The next request/interval starts after the preceding one has ended. That means a big timeout (IGetStateServiceConfig.timeout) could cause an actual higher update interval (IGetStateServiceConfig.updateInterval).
Tells you whether the service has most recent status information or not.
More accurately it tells you whether the most recent request succeeded or
not. So it will return true
if the request succeeded and your data is
up-to-date. It will return false
until the service retrieved its first
data and again if a subsequent request fails.
Start the service.
This will periodically update the internal data and invoke the optional callables each time new data is received.
Optional
successCallback: ((data: GetStateData) => void)Will be triggered everytime the service receives new data. The current GetStateData object is passed as parameter to the callback.
Optional
errorCallback: ((e: Error) => void)Error callback receives the most recent error as parameter, in case the consecutive error tolerance is hit.
Optional
stopOnError: booleanWhether to stop in case the consecutive error tolerance is hit. Default behavior (for backward compatibility) is to keep running in any case.
Update data by staging an HTTP request to the pool controller.
This method will be triggered periodically once the service
has been started (see GetStateService.start). It also
includes the part responsible for the execution of the
[[_updateCallback
]] (see start).
The GetStateService implements the AbstractService for the
/GetState.csv
endpoint.