Skip to content

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

License

Notifications You must be signed in to change notification settings

pinazo/hlc-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hlc-server

HLC: Hyperlocal Context for the IoT

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. Learn more at: context.reelyactive.com

In the scheme of Things (pun intended)

hlc-server acts as a convenience wrapper around our other npmjs packages, barnowl, barnacles, barterer and chickadee. You may consult the documentation for each individual package for a better understanding of the ensemble.

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 on our developer page.

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/contextnear/tags/test) to see a contextual visualisation of what is near the test device(s). Alternatively, browse to http://localhost:3001/whatnear/transmitter/fee150bada55 for a non-contextual visualisation of the same query.

RESTful interactions

Include Content-Type: application/json in the header of all interactions in which JSON is sent to hlc-server.

GET /whereis/transmitter/{device-id}

GET /whatnear/transmitter/{device-id}

GET /whatat/receiver/{device-id}

See barterer.

GET /contextnear/transmitter/{device-id}

GET /contextnear/tags/{device-id}

GET /contextat/receiver/{device-id}

GET /contextat/directory/{device-id}

GET /contextat/tags/{device-id}

See chickadee.

GET/PUT/DELETE /associations/{device-id}/

GET/PUT/DELETE /associations/{device-id}/url

GET/PUT/DELETE /associations/{device-id}/directory

GET/PUT/DELETE /associations/{device-id}/tags

See chickadee.

POST /events

See barnacles.

GET /statistics

See barnacles.

GET /at/{directory}

Legacy route (deprecated). Redirects to /contextat/directory/{directory}.

GET /id/{device-id}

Legacy route (deprecated). Redirects to /contextat/receiver/{device-id} if the device id matches that of a receiver, otherwise to /contextnear/transmitter/{device-id}.

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 password is 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,
  password: 'admin',
  secret: "YoureProbablyGonnaWantToChangeIt",
  useCors: false,
  protectedRequests: [
    { path: "/associations/", methods: [ "PUT", "DELETE" ] }
  ],
  barnowl: { n: 3, enableMixing: true }, // see barnowl
  barnacles: {},                         // see barnacles
  barterer: {},                          // see barterer
  chickadee: {}                          // see chickadee
}

Note that if you see Access-Control-Allow-Origin errors, you'll likely want to set useCors to true. To remove authentication from all routes, set protectedRequests to [].

Implicit Associations

Consult the documentation for chickadee to learn more about which devices are implicitly associated (via their identifier) with static metadata or a third-party API (via a URL).

What's next?

This is an active work in progress. Expect regular changes and updates, as well as improved documentation! If you're developing with hlc-server check out:

License

MIT License

Copyright (c) 2014-2015 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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 58.0%
  • HTML 35.5%
  • CSS 6.5%