isobarot-edge-gateway
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

isobarot-edge-gateway

  • Client library for sending data to isobarot cloud over HTTP or MQTT.

Getting Started

npm install --save isobarot-edge-gateway

HTTP Example - Local

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();

MQTT Example - Local

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();

Package Sidebar

Install

npm i isobarot-edge-gateway

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

47.9 kB

Total Files

30

Last publish

Collaborators

  • bjelicaluka