node package manager

ngsijs

ngsijs

License Documentation Status Build Status Coverage Status

Ngsijs is the JavaScript library used by WireCloud for adding FIWARE NGSI capabilities to widgets and operators. However, this library has also be designed to be used in other environments as normal web pages and clients/servers running on Node.js.

This library has been developed following the FIWARE NGSI v1 and NGSI v2 specifications and has been tested to work against version 0.26.0+ of the Orion Context Broker.

Using ngsijs from normal web pages

Just include a <script> element linking to the NGSI.min.js file:

    <script type="text/javascript" src="url_to_NGSI.js"></script> 

Once added the <script> element, you will be able to use all the features provided by the ngsijs library except receiving notifications. To be able to receive notifications inside a web browser the library requires the use of a ngsi-proxy server.

Using ngsijs from Node.js

  npm install ngsijs

After installing the ngsijs node module, you will be able to use the API as usual:

  var NGSI = require('ngsijs');
  var connection = new NGSI.Connection("http://orion.example.com:1026");

Note: Node.js doesn't require the usage of a ngsi-proxy as you can create an HTTP endpoint easily (e.g. using express).

Using ngsijs from WireCloud widgets/operators

Take a look to the "3.2.1. Using Orion Context Broker" tutorial available at FIWARE Academy.