- Client library for sending data to isobarot cloud over HTTP or MQTT.
npm install --save isobarot-edge-gateway
const { EdgeGateway } = require("isobarot-edge-gateway");
const gateway = new EdgeGateway({
type: "local",
configurationApiUrl: "https://api.isobarot.com/path-to-config",
configurationMqttBrokerUrl: "api.isobarot.com",
configurationMqttTopic: "config",
isobarCloudSenderParams: {
url: "api.isobarot.com",
},
});
gateway.init();
gateway.setValue("<sensor-id or custom-topic>", {
apiToken: "<token>",
record: {
// ...
},
});
// on application close
gateway.dispose();
const { EdgeGateway } = require("isobarot-edge-gateway");
const gateway = new EdgeGateway({
type: "local",
configurationApiUrl: "https://api.isobarot.com/path-to-config",
configurationMqttBrokerUrl: "api.isobarot.com",
configurationMqttTopic: "config",
isobarCloudSenderParams: {
url: "api.isobarot.com",
type: "mqtt"
},
});
gateway.init();
gateway.setValue("<sensor-id or custom-topic>", {
apiToken: "<token>",
record: {
// ...
},
});
// on application close
gateway.dispose();
MQTT Example - Hub - To be implemented
const { EdgeGateway } = require("isobarot-edge-gateway");
const gateway = new EdgeGateway({
type: "hub",
hubPort: 1883,
configurationApiUrl: "https://api.isobarot.com/path-to-config",
configurationMqttBrokerUrl: "api.isobarot.com",
configurationMqttTopic: "config",
isobarCloudSenderParams: {
url: "api.isobarot.com",
type: "mqtt"
},
});
gateway.init();
/*
Hub is listening on 0.0.0.0:1883
Publish to <topic> { apiToken: <token>, record: { ... } }
*/
// on application close
gateway.dispose();