0.2.24 • Published 9 years ago

nitrogen v0.2.24

Weekly downloads
246
License
-
Repository
github
Last release
9 years ago

Nitrogen Client

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 leverages the ubiquity of Javascript.

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 = new nitrogen.Device({
    tags: ['sends:temperature'],
    nickname: 'thermometer'
});

var service = new nitrogen.Service(config);
service.connect(thermometer, function(err, session, thermometer) {

    // take temperature every 15 minutes.

    setInterval(function() {
        var message = new Nitrogen.Message({
            type: 'temperature',
            body: {
                temperature: getTemp()
            }
        });

        message.save(session);
    }, 15 * 60 * 1000);

});

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 = new nitrogen.User({...});

var service = new nitrogen.Service(config);
service.connect(user, function(err, session, user) {
    session.onMessage({ type: 'temperature' }, function(message) {
        console.log("The temperature is now: " + message.body.temperature);

        // update the UI
    });
});

Getting Started

To get started with a Nitrogen client:

Node.js application

  1. npm install nitrogen

Browser application

  1. Add <script src="https://api.nitrogen.io/client/nitrogen-min.js" /> to your application.

Documentation

Documentation for the Nitrogen client library can be found online at the Nitrogen project.

Contributing to the project.

  1. Clone or fork this repo: https://github.com/nitrogenjs/client
  2. 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
  3. Fetch and install its node.js dependencies: npm install
  4. Run a Nitrogen server locally that the tests can run against in test mode (NODE_ENV=test).
  5. Run the tests to make sure everything is setup correctly: npm test
  6. Make your change as a clean commit for a pull request.
  7. Make sure there is a test to cover new functionality so nobody can break it in the future without us knowing.
  8. Submit it as a pull request to the project.

How to contribute

  1. 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 timfpark@gmail.com or file an issue with us above.
  2. 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.
  3. 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)
  • OpenSSL (normal, not light) in the same bitness as your Node.js installation.
    • The build script looks for OpenSSL in the default install directory (C:\OpenSSL-Win32 or C:\OpenSSL-Win64)
    • 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.

Nitrogen Project

The Nitrogen project is housed in a set of GitHub projects:

  1. service: Core platform responsible for managing principals, security, and messaging.
  2. client: JavaScript client library for building Nitrogen devices and applications.
  3. admin: Administrative tool for managing the Nitrogen service.
  4. device: Adaptors for common pieces of hardware.
  5. commands: CommandManagers and schemas for well known command types.
  6. cli: Command line interface for working with a Nitrogen service.
0.2.24

9 years ago

0.2.23

9 years ago

0.2.22

9 years ago

0.2.21

9 years ago

0.2.20

9 years ago

0.2.19

9 years ago

0.2.18

9 years ago

0.2.17

10 years ago

0.2.16

10 years ago

0.2.15

10 years ago

0.2.14

10 years ago

0.2.13

10 years ago

0.2.12

10 years ago

0.2.11

10 years ago

0.2.9

10 years ago

0.2.8

10 years ago

0.2.7

10 years ago

0.2.6

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.329

10 years ago

0.1.328

10 years ago

0.1.327

10 years ago

0.1.326

10 years ago

0.1.325

10 years ago

0.1.324

10 years ago

0.1.323

10 years ago

0.1.322

10 years ago

0.1.321

10 years ago

0.1.320

10 years ago

0.1.319

10 years ago

0.1.318

10 years ago

0.1.317

10 years ago

0.1.316

10 years ago

0.1.315

10 years ago

0.1.314

10 years ago

0.1.313

10 years ago

0.1.312

10 years ago

0.1.310

10 years ago

0.1.309

10 years ago

0.1.308

10 years ago

0.1.307

10 years ago

0.1.306

10 years ago

0.1.305

10 years ago

0.1.304

10 years ago

0.1.302

10 years ago

0.1.301

10 years ago

0.1.238

10 years ago

0.1.237

10 years ago

0.1.235

10 years ago

0.1.234

10 years ago

0.1.233

10 years ago

0.1.232

10 years ago

0.1.230

10 years ago

0.1.229

10 years ago

0.1.228

10 years ago

0.1.226

10 years ago

0.1.225

10 years ago

0.1.224

10 years ago

0.1.223

10 years ago

0.1.222

10 years ago

0.1.221

10 years ago

0.1.220

10 years ago

0.1.219

10 years ago

0.1.218

10 years ago

0.1.217

10 years ago

0.1.216

10 years ago

0.1.215

10 years ago

0.1.214

10 years ago

0.1.213

10 years ago

0.1.211

10 years ago

0.1.210

10 years ago

0.1.209

10 years ago

0.1.208

10 years ago

0.1.207

10 years ago

0.1.206

10 years ago

0.1.205

10 years ago

0.1.204

10 years ago

0.1.203

10 years ago

0.1.202

10 years ago

0.1.201

10 years ago

0.1.200

10 years ago

0.1.113

10 years ago

0.1.111

10 years ago

0.1.110

10 years ago

0.1.109

10 years ago

0.1.108

10 years ago

0.1.107

10 years ago

0.1.105

10 years ago

0.1.102

10 years ago

0.1.101

10 years ago

0.1.100

10 years ago

0.1.45

11 years ago

0.1.44

11 years ago

0.1.43

11 years ago

0.1.42

11 years ago

0.1.41

11 years ago

0.1.40

11 years ago

0.1.38

11 years ago

0.1.37

11 years ago

0.1.36

11 years ago

0.1.35

11 years ago

0.1.34

11 years ago

0.1.33

11 years ago

0.1.32

11 years ago

0.1.31

11 years ago

0.1.26

11 years ago

0.1.25

11 years ago

0.1.24

11 years ago

0.1.23

11 years ago

0.1.21

11 years ago

0.1.20

11 years ago

0.1.19

11 years ago

0.1.18

11 years ago

0.1.16

11 years ago

0.1.15

11 years ago

0.1.14

11 years ago

0.1.13

11 years ago

0.1.12

11 years ago

0.1.11

11 years ago

0.1.10

11 years ago

0.1.9

11 years ago

0.1.8

11 years ago

0.1.7

11 years ago

0.1.6

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.110

11 years ago

0.0.109

11 years ago

0.0.108

11 years ago

0.0.107

11 years ago

0.0.106

11 years ago

0.0.105

11 years ago

0.0.104

11 years ago

0.0.103

11 years ago

0.0.102

11 years ago

0.0.101

11 years ago

0.0.100

11 years ago

0.0.99

11 years ago

0.0.98

11 years ago

0.0.97

11 years ago

0.0.96

11 years ago

0.0.95

11 years ago

0.0.94

11 years ago

0.0.93

11 years ago

0.0.92

11 years ago

0.0.91

11 years ago

0.0.89

11 years ago

0.0.88

11 years ago

0.0.87

11 years ago

0.0.86

11 years ago

0.0.85

11 years ago

0.0.84

11 years ago

0.0.83

11 years ago

0.0.82

11 years ago

0.0.81

11 years ago

0.0.80

11 years ago

0.0.79

11 years ago

0.0.78

11 years ago

0.0.77

11 years ago

0.0.76

11 years ago

0.0.74

11 years ago

0.0.73

11 years ago

0.0.72

11 years ago

0.0.71

11 years ago

0.0.70

11 years ago

0.0.69

11 years ago

0.0.67

11 years ago

0.0.66

11 years ago

0.0.65

11 years ago

0.0.64

11 years ago

0.0.63

11 years ago

0.0.61

11 years ago

0.0.60

11 years ago

0.0.59

11 years ago

0.0.58

11 years ago

0.0.57

11 years ago

0.0.56

11 years ago

0.0.55

11 years ago

0.0.54

11 years ago

0.0.53

11 years ago

0.0.52

11 years ago

0.0.50

11 years ago

0.0.49

11 years ago

0.0.48

11 years ago

0.0.47

11 years ago

0.0.46

11 years ago

0.0.45

11 years ago

0.0.44

11 years ago

0.0.43

11 years ago

0.0.42

11 years ago

0.0.41

11 years ago

0.0.40

11 years ago

0.0.39

11 years ago

0.0.38

11 years ago

0.0.37

11 years ago

0.0.36

11 years ago

0.0.35

11 years ago

0.0.34

11 years ago

0.0.33

11 years ago

0.0.32

11 years ago

0.0.31

11 years ago

0.0.30

11 years ago

0.0.29

11 years ago

0.0.28

11 years ago

0.0.27

11 years ago

0.0.26

11 years ago