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 provides a layer on top of 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.
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.
- reelyActive Active RFID Tag (RA-T411)
- Identifier Type: EUI-64
- URL: http://reelyactive.com/metadata/ra-t411.json
- Product link
- reelyActive Bluetooth Smart reelceiver (RA-R436)
- UUID: 7265656c794163746976652055554944
- URL: http://reelyactive.com/metadata/ra-r436.json
- Product link
- WNDR app
- UUID: 2f521f8c4d6f12269c600050e4c00067
- Product link
- Thalmic Labs Myo
- UUID: d5060001a904deb947482c7f4a124842
- URL: http://reelyactive.com/metadata/myo.json
- Product link
- Nod (OpenSpatial)
- UUID: febf
- URL: http://reelyactive.com/metadata/nod.json
- Product link
- Estimote beacon
- iBeacon UUID: b9407f30f5f8466eaff925556b57fe6d
- URL: http://reelyactive.com/metadata/estimote.json
- Product link
- Roximity beacon
- iBeacon UUID: 8deefbb9f7384297804096668bb44281
- URL: http://reelyactive.com/metadata/roximity.json
- Product link
- Apple devices
- companyIdentifierCode: 004c
- URL: http://reelyactive.com/metadata/apple.json
- Curious devices (any SCAN_REQ)
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.