1.6.3 • Published 3 years ago

@senseering/worker v1.6.3

Weekly downloads
28
License
ISC
Repository
github
Last release
3 years ago

Motivation

Connecting IoT devices and services to management tools and anlytics can be cumbersome. The Senseering Worker provides a simple interface to the senseering world written in Node.js. Examples for common scenarios (e.g. MQTT, HTTP and OPC-UA) can be found in the given example repository.

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js.

Installation is done using the npm install command:

npm install @senseering/worker

Worker Description

A worker is the basic building block for our approach to a decentralised data plattform. It utilizes the manager for storing, managing and selling our data on the senseering myDataEconomy-plattform. The workers objective is to process or generate data based on sensor inputs or other available feeds. It can be run as a source that only publishes data to your liking (e.g. send every few seconds the new sensor inputs) or as a service, which provides a service function that can be triggered on demand (e.g. a weather station that should only publish on demand or an image recognition service). Also a mixture of those two types is possible. This should give a short introduction to workers and the possible use cases. Below you can find more information to the config object and the api of worker_js.

Config object high level description

PropertySubpropertyTypeDescription
credentialsStringIdentifier for connection to manager in format ':'
urlStringProtocol and domain of manager
settingsObjectSome general settings on the worker's behaviour
qualityOfServiceNumber0: receive at most once, 1: receive at least once
messageRetriesNumberNumber of tries for sending of messages
messageTimeoutNumberNumber of milliseconds to wait until timeout of message
metaObjectwith key-value-pairs, meta field can be added to the data packages of this worker
paymentObjectFixed price and boolean option for additional pricing
fixCostIntegerFixed costs of the data packages
isFixCostOnlyBooleanCan additional costs apply?
profileObjectGeneral information on worker
nameStringThe fully qualified name by which the worker should be called
locationObject2D GPS coordinate of the worker
latitudeNumberLatitude of worker location
longitudeNumberLongitude of worker location
privKeyStringURI reference to the private key used to signing
schemaObjectEither single or community schema and boolean option for schema check on worker
inputStringURI reference to the input schema in .json format
outputStringURI reference to the output schema in .json format
infoObjectobject containing all relevant information
workerObjectinformation for worker
descriptionStringURI reference to the worker info in .md format
tagsArraytags under which this worker wants to be found
inputObjectinformation for input data
descriptionStringURI reference to the input info in .md format
tagsArraytags under which this worker wants to be found
outputObjectinformation for output data
descriptionStringURI reference to the output info in .md format
tagsArraytags under which this worker wants to be found

Worker API

worker.connect:

config (object): The config object of the worker

Sets up the connection to the manager, registers the worker and generates keys.

worker.publish:

data (object): Object that will be published

Publishes desired data on the manager

worker.provide:

service (function): function that returns data

Provides the service function that can be triggered on demand

worker.settings.get:

No parameters

Returns the current settings of the connection to the manager

worker.settings.update:

settings (object): New settings object for worker

Updates the settings of the connection of the worker to the manager (First use worker.settings.get and modify the resulting object, before handing it to worker.settings.update)

worker.meta.get:

No parameters

Returns the currently used meta data that are added to each published data point

worker.meta.update:

meta (object): New meta data object that will be added to each data point before publication

Updates the meta data

worker.disconnect:

No parameters

Stops the connection to the manager

Templates in workers

A detailed explanation to templates and the idea behind it can be found in the template_js repository. For the worker itself it is only needed to know that templates are a high level description of the exact data structure in JSON-LD Format. The incoming and outgoing data must be described in that way so every worker knows what to expect from the incoming data and is able to work on it.

1.6.3

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.14

4 years ago

1.3.15

4 years ago

1.3.13

4 years ago

1.3.12

4 years ago

1.3.11

4 years ago

1.3.10

4 years ago

1.3.9

4 years ago

1.3.0

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.2-dev

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago