Giter Club home page Giter Club logo

webofthings.js's Introduction

Node.js Web of Things Server

A server and gateway reference implementation of the W3C Web Thing Model, written in Node.js and tailored for embedded systems.

Note: while this code is used in the Building the Web of Things book, it isn't the code of the book which you can find here.

What is the Web Thing Model?

It's a simple model for Things to interact together and with app via the Web. Read more about it in a blogpost or even more in a webinar!

What is webofthings.js?

A simple, lightweight, and extensible implementation of the W3C Web of Things Model. in Node.js. It not (yet) a bomb proof gateway but a way to experiment with the Web of Things and the basis of the Building the Web of Things book where you'll learn how the framework works, how to deploy it on a Raspberry Pi and how to use it to serve Web access to sensors and actuators.

What does this do?

First, it implements a Web of Things server that you can run on any platform that supports Node and in particular on many embedded devices. Second, it exposes the services and function of your service over HTTP and WebSockets.

What devices does it support?

Any Windows or *Nix device really but if you want to use the GPIOs you will need an embedded device. The framework was tested on the Raspberry Pi (A, B, B+, Zero and 2) and the Beaglebone Black. Most of the code also works on the Intel Edison.

Note: currently webofthings.js only works with Node < 5.0.0 (due to the removal of Object.observe() from ES6) and was tested on the target devices with the Node 4 LTS. If you really want to use Node > 4, check the ES6-compatibility branch.

How is it built?

application architecture

How do I start it?

NPM

Install it: npm install webofthings

Run it: node wot.js or sudo node wot.js if you plan to use the temperature and humidity plugins.

How do I configure it?

The WoT gateway can be tweaked by changing the configuration parameters in /resources/piNoLd.json. The following parameters are available:

  "customFields": {
    "hostname":"localhost",
    "port": 8484,
    "secure": true, // true means the gateway will require HTTPS and an API key
    "dataArraySize" : 30 // size of the Properties and Actions arrays.
  },

If you use it in a serious environment make sure you:

  1. Generate/buy your own TLS certificates to replace the public certificate and private key in /resources.
  2. Make sure you generate a new API token to replace the default one (cKXRTaRylYWQiF3MICaKndG4WJMcVLFz) in /resources/auth.json, you can use the utils.generateApiToken() function to generate a new one.

How do I extend it?

The WoT Gateway framework comes with three internal plugins to connect it to sensors and actuators:

  • dht22Plugin.js to connect a temperature and humidity sensor
  • ledsPlugin.js to connect it to LEDs
  • pirPlugin.js to connect it to a passive infrared sensor

but it can easily be extended by adding internal or external plugins (i.e., to serve the resources of other devices via a Web API) extending corePlugin.js.

How do I run the tests?

  1. Install mocha npm install -g mocha
  2. Run the tests mocha

How do I learn more about the Web of Things?

Browse http://webofthings.org and/or buy the Building the Web of Things Book

building the web of things

webofthings.js's People

Contributors

domguinard avatar vladounet avatar marcbachmann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.