Brokoli is a client for Orion Context Broker It uses Orion Context Broker as data storage and works around it's stupid design decisions.
npm install brokoli
var brokoli = require("brokoli");
var client = brokoli({
url: "http://user:password@localhost:1026/v1/",
auth_token: ""
});
// create an entity
client.save(1, {
bla: "fasel",
blub: 1,
foo: "bar <= baz"
}, function(err, result){
if (err) return console.log(err);
});
Create an instance of brokoli. Opts may contain
{
"url": "https://127.0.0.1:1026/v1/", // base url of orion context broker
"auth_token": "<auth token>", // auth token, if needed
"type": "whatever", // global entity type
"strictssl": true // obey/ignore ssl warnings
}
Save an entity. id
is an identifier, data
is a key/value object.
Delete an entity by id
.
Get an entity by id
:
{
"id": "<id>",
"data": {
"foo": "bar",
"bla": "fasel",
"blub": 1
}
}
Retrieve all entities:
[{
"id": "<id>",
"data": {
"foo": "bar",
"bla": "fasel",
"blub": 1
}
},{
...
}]