Skip to main content

App SDK

Runs on your server or in the browser. Manage devices, stream telemetry, send commands, configure alerts, and organize device groups.

JavaScriptPython

Install

npm install @relay-x/app-sdk

Initialize

Create a RelayApp instance with your API key and secret from console.relay-x.io.

const { RelayApp } = require("@relay-x/app-sdk");

const app = new RelayApp({
api_key: "your_api_key",
secret: "your_secret",
mode: "production",
});

await app.connect();

The mode parameter separates your data into isolated environments so test data never mixes with production:

  • "production" — Live environment for real device data
  • "test" — Isolated sandbox for development and testing

Modules

Quick Example

Stream live temperature data from a device and log it:

const { RelayApp } = require("@relay-x/app-sdk");

const app = new RelayApp({
api_key: "your_api_key",
secret: "your_secret",
mode: "production",
});

// monitor connection
app.connection.listeners((event) => {
console.log("Connection:", event);
});

await app.connect();

// stream live telemetry
app.telemetry.stream({
device_ident: "sensor_01",
metric: ["temperature"],
callback: (data) => {
console.log(`${data.metric}: ${JSON.stringify(data.data)}`);
},
});

Disconnect

await app.disconnect();