This is the client library for developing applications and devices that communicate to the Nitrogen service.
Device Development Model
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 =
var service = config;
You can find a complete example for a device application of Nitrogen in the camera project.
Listening to a device's message stream
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;
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.
Contributing to the project.
- Clone or fork this repo:
- If you are building on Windows, make sure to fetch all of the node-gyp dependencies as explained here: https://github.com/TooTallNate/node-gyp#installation
- Fetch and install its node.js dependencies:
- Run a Nitrogen server locally that the tests can run against in test mode (NODE_ENV=test).
- Run the tests to make sure everything is setup correctly:
- Make your change as a clean commit for a pull request.
- Make sure there is a test to cover new functionality so nobody can break it in the future without us knowing.
- Submit it as a pull request to the project.
How to contribute
- Feedback: We'd love feedback on what problems you are using Nitrogen to solve. Obviously, we'd also like to hear about where you ran into sharp edges and dead ends. Drop me a message at firstname.lastname@example.org or file an issue with us above.
- Pull requests: If you'd like to tackle an issue, fork the repo, create a clean commit for the fix or enhancement with tests if necessary, and send us a pull request. This is also the path to becoming a core committer for the project for folks that are interested in contributing in more depth.
- Documentation: Better technical documentation is key to broadening the use of the platform. We'd love to have more help and this is one of the most valuable contributions you can make.
Running on Windows
On Windows, you'll need to install some dependencies first:
- node-gyp (
npm install -g node-gyp)
- Python 2.7 (not 3.3)
- Visual Studio 2010 or higher (including Express editions)
- Windows XP/Vista/7:
- Windows 8:
- Microsoft Visual Studio C++ 2012 for Windows Desktop (Express version works well)
- OpenSSL (normal, not light)
in the same bitness as your Node.js installation.
- The build script looks for OpenSSL in the default install directory (
- If you get
Error: The specified module could not be found., copy
libeay32.dll from 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:
- service: Core platform responsible for managing principals, security, and messaging.
- admin: Administrative tool for managing the Nitrogen service.
- device: Adaptors for common pieces of hardware.
- commands: CommandManagers and schemas for well known command types.
- cli: Command line interface for working with a Nitrogen service.