JSPM

  • Created
  • Published
  • Downloads 22
  • Score
    100M100P100Q54663F
  • License MIT

Serves up hyperlocal context (HLC) for the Internet of Things by associating all devices identified in a Smart Space with their respective metadata. We believe in an open Internet of Things.

Package Exports

  • hlc-server

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hlc-server) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

hlc-server

HLC: Hyperlocal Context

How can computers understand the context of what's happening in a space? First and foremost, they need a digital representation of everything and everyone that is present. Hyperlocal context is a digital snapshot of a physical space and its contents. It combines the concepts of identification, location and time. Read more at: context.reelyactive.com

hlc-server acts as a wrapper around our other npmjs packages, barnowl and barnacles. Please first consult the documentation for barnowl which is far more mature at this point!

hlc-server is the middle piece in the json-silo - hlc-server - smartspaces stack. The easiest way to learn how these all fit together is our Make a Smart Space tutorial.

Installation

npm install hlc-server

Hello Hyperlocal Context

var server = require('hlc-server');
var app = new server();

// See barnowl: "Where to listen?"
app.bind( { protocol: 'test', path: 'default' } );

Then browse to http://localhost:3001 to see the landing page.

HLC landing page

Type test in the search bar (or browse to http://localhost:3001/at/test) to see the following test output:

{
  "_meta": {
    "message": "ok",
    "statusCode": 200
  },
  "_links": {
    "self": { "href": "http://localhost:3001/at/test" }
  },
  "devices": {
    "001bc50940100000": {
      "identifier": {
        "type": "EUI-64",
        "value": "001bc50940100000"
      },
      "url": "http://reelyactive.com/metadata/test.json",
      "href": "http://localhost:3001/id/001bc50940100000"
    }
  }
}

Querying Hyperlocal Context

To query the real-time context where a Bluetooth Smart device is emitting the AdvA-48 identifier 1a:2b:3c:4d:5e:6f make the following request:

To query the real-time context of a place named notman make the following request:

A test place is permanently enabled and is associated with IDs 001bc50940800000 and 001bc50940810000:

Administrative Interface

Browse to http://localhost:3001/admin to associate IDs with URLs containing JSON metadata, and to add places and their associated IDs. The default username and password are both admin.

Connecting with services

You can connect the barnacles inside hlc-server with any of the services they support. For detailed information about each service consult the barnacles documentation. A service is added as follows:

app.addNotificationService(options);

Options

You can create an instance of hlc-server with any or all of the following options (what's shown are the defaults):

{
  httpPort: 3001,
  authUser: 'admin',
  authPass: 'admin',
  useCors: false,
  maxDecoders: 3,
  maxStaleMilliseconds: 10000
}

Note that if you see Access-Control-Allow-Origin errors, you'll likely want to set useCors to true.

Implicit Associations

The following implicit associations are supported. In other words, the implicit url will be provided unless the device is already uniquely associated, via its identifier, with a url. If you're one of the manufacturers below and would like the URL to instead point to an API on your server please contact us.

What's next?

This is an active work in progress. Expect regular changes and updates, as well as improved documentation!

License

MIT License

Copyright (c) 2014 reelyActive

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.