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 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
Alternatively, use the Docker repository: reelyactive/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.
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.
Additional Visualisations
bubblescape
Browse to http://localhost:3001/bubblescape/ (see bubblescape).
sensorscape
Browse to http://localhost:3001/sensorscape/ (see sensorscape).
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.
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
The chickadee package uses sniffypedia.org to implicitly associate devices with metadata via their identifier(s).
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:
- diyActive our developer page
- our node-style-guide and angular-style-guide for development
- our contact information to get in touch if you'd like to contribute
License
MIT License
Copyright (c) 2014-2016 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.