npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@senseering/worker

v1.6.3

Published

Client library to connect to the [manager](https://github.com/Senseering/manager).

Downloads

24

Readme

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

| Property | Subproperty | | Type | Description | |--------|--------|----------|------|------| | credentials | | | String | Identifier for connection to manager in format ':' | | url | | | String | Protocol and domain of manager | | settings | | | Object | Some general settings on the worker's behaviour | | | qualityOfService | | Number | 0: receive at most once, 1: receive at least once | | | messageRetries | | Number | Number of tries for sending of messages | | | messageTimeout | | Number | Number of milliseconds to wait until timeout of message | | meta | | | Object | with key-value-pairs, meta field can be added to the data packages of this worker | | payment | | | Object | Fixed price and boolean option for additional pricing | | | fixCost | | Integer | Fixed costs of the data packages | | | isFixCostOnly | | Boolean | Can additional costs apply? | | profile | | | Object | General information on worker | | | name | | String | The fully qualified name by which the worker should be called | | | location | | Object | 2D GPS coordinate of the worker | | | | latitude | Number | Latitude of worker location | | | | longitude | Number | Longitude of worker location | | privKey | | String | URI reference to the private key used to signing | | schema | | Object | Either single or community schema and boolean option for schema check on worker | | | input | String | URI reference to the input schema in .json format | | | output | String | URI reference to the output schema in .json format | | info | | | Object | object containing all relevant information | | | worker | | Object | information for worker | | | | description | String | URI reference to the worker info in .md format | | | | tags | Array | tags under which this worker wants to be found | | | input | | Object | information for input data | | | | description | String | URI reference to the input info in .md format | | | | tags | Array | tags under which this worker wants to be found | | | output | | Object | information for output data | | | | description | String | URI reference to the output info in .md format | | | | tags | Array | tags 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.