Nitrogen is a platform for building connected devices. Nitrogen provides the authentication, authorization, and real time message passing framework so that you can focus on your device and application. All with a consistent development platform that lev
This is the client library for developing applications and devices that communicate to the Nitrogen service.
Nitrogen at its heart uses messaging between principals (devices and users). Principals in the system can create and consume messages. Messages can follow a well known schema to enable interoperability between applications or use their own private custom message types.
For example, a thermometer that measures temperature once every 15 minutes could be implemented in Nitrogen like this:
var thermometer =tags: 'sends:temperature'nickname: 'thermometer';var service = config;serviceconnectthermometer// take temperature every 15 minutes.setIntervalvar message =type: 'temperature'body:temperature: getTemp;messagesavesession;15 * 60 * 1000;;
You can find a complete example for a device application of Nitrogen in the camera project.
An application that displays these temperatures in real time as they are received would look like this. In this case, we're using a user principal, and a filter with onMessage to only notify us of temperature updates.
var user = ;var service = config;serviceconnectusersessiononMessage type: 'temperature'console.log"The temperature is now: " + messagebodytemperature;// update the UI;;
To get started with a Nitrogen client:
npm install nitrogen
<script src="https://api.nitrogen.io/client/nitrogen-min.js" />to your application.
Documentation for the Nitrogen client library can be found online at the Nitrogen project.
On Windows, you'll need to install some dependencies first:
npm install -g node-gyp)
Error: The specified module could not be found., copy
libeay32.dllfrom the OpenSSL bin directory to this module's bin directory, or to Windows\System3.
The Nitrogen project is housed in a set of GitHub projects: