This is a pub/sub server. It was designed with prototyping sensor applications in mind. See this blog post for more details on that.
npm install
npm start
This server takes POST requests, with content-type application/json
, to the route /
.
The JSON must include a type
field
{
type: 'someString'
}
It can include any other fields you like ontop of that:
{
type: 'neurosky-mindwave',
reading: {
raw_values: [1353523, 216363, 1235 ... ],
attention_esense: 53,
meditation_esense: 83
}
}
then, on the client side, we can subscribe to socket.IO with type
as the event:
var socket = io('my-indra-server')
socket.on('neurosky-mindwave', function (d) {
// do stuff with the neurosky data
})
As an added bonus, the data you get back when you subscribe will contain a receivedAt
field indicating when the data got to the server.
stuff should be pretty self-explanatory.
to run the tests,
npm start
to run the server, then
npm test