npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@empa-electronics/tiremo-sdk-client-js

v0.1.6

Published

Browser JavaScript client for the TIREMO SDK REST and live WebSocket APIs

Readme

@empa-electronics/tiremo-sdk-client-js

Browser / bundler client for the TIREMO SDK. Uses native fetch and WebSocket with no runtime dependencies.

Works with React, Vue, Svelte, Vite, or plain ES modules.

Documentation

| Topic | Link | | --- | --- | | SDK Live Data | docs.tiremo.ai/developer-guide/sdk-live-data | | API Key Security | docs.tiremo.ai/developer-guide/sdk-api-key-security | | HTML examples | TIREMO-SDK/examples |

Getting started

1. Install

npm install @empa-electronics/tiremo-sdk-client-js

2. Get an API key

Create a product-scoped API key in the Tiremo Platform Administration → API Credentials UI.

For browser apps use a public key with origin restrictions. Public keys cannot open WebSocket connections directly — mint a short-lived token on your backend first.

3. Create a client

import { TiremoClient } from "@empa-electronics/tiremo-sdk-client-js";

const client = new TiremoClient({
  baseUrl: "https://sdk.tiremo.ai",
  apiKey: process.env.TIREMO_API_KEY!,
});

baseUrl is your SDK host without a trailing slash. apiKey is sent as the X-API-Key header on REST calls.

4. Typical browser flow

  1. Load the latest stored telemetry over REST (bootstrap gauges/charts).
  2. On your backend, call createToken() with a secret key.
  3. Pass the token to the browser and connect with connectWithToken().
  4. Subscribe to live channels after the connected event.

Usage examples

TiremoClient — REST

devices.getTelemetryLatest(deviceIdentifier, options?)

Fetch the most recent stored telemetry point for a device.

const latest = await client.devices.getTelemetryLatest("cameradevice9", {
  keys: ["temperature", "humidity"],
});

console.log(latest.timestamp);
console.log(latest.data.temperature);
// { deviceIdentifier, timestamp, data: { temperature: 21.4, ... } }

Omit keys to receive all keys for the latest point.

live.createToken()

Exchange your API key for a short-lived WebSocket token. Call this from a server route, not from browser code with a secret key.

const { token, expiresAt } = await client.live.createToken();
// Pass `token` to the browser (e.g. JSON API response)

live.connectWithToken(token)

Create a live client authenticated with a short-lived token (browser-safe).

const live = client.live.connectWithToken(token);

live.connectWithSecretKey()

Connect with the secret API key directly. Do not use in browser code — only for trusted server-side scripts.

const live = client.live.connectWithSecretKey();

TiremoLiveClient — WebSocket

connect() / disconnect()

live.connect();
// ...
live.disconnect();

on(event, handler)

Register event handlers. Returns an unsubscribe function.

const off = live.on("telemetry", (event) => {
  console.log(event.subscriptionId, event.data);
});

off(); // remove handler

Events: connected, telemetry, presence, alarm, error, message.

live.on("connected", (event) => {
  console.log(event.productIdentifier, event.protocolVersion);
});

live.on("presence", (event) => {
  console.log(event.deviceIdentifier, event.isOnline);
});

live.on("alarm", (event) => {
  console.log(event.alarmType, event.severity, event.code);
});

live.on("error", (event) => {
  console.error(event.code, event.message);
});

subscribeTelemetry({ id, deviceIdentifier, keys? })

live.on("connected", () => {
  live.subscribeTelemetry({
    id: "temp-sub",
    deviceIdentifier: "cameradevice9",
    keys: ["temperature"],
  });
});

subscribePresence({ id, deviceIdentifier })

live.subscribePresence({
  id: "presence-sub",
  deviceIdentifier: "cameradevice9",
});

subscribeAlarm({ id, deviceIdentifier })

live.subscribeAlarm({
  id: "alarm-sub",
  deviceIdentifier: "cameradevice9",
});

unsubscribe(subscriptionId)

live.unsubscribe("temp-sub");

Ping/pong heartbeats are handled automatically.

Full example

import { TiremoClient } from "@empa-electronics/tiremo-sdk-client-js";

const client = new TiremoClient({
  baseUrl: "https://sdk.tiremo.ai",
  apiKey: process.env.TIREMO_API_KEY!,
});

const latest = await client.devices.getTelemetryLatest("cameradevice9", {
  keys: ["temperature"],
});

const { token } = await client.live.createToken();
const live = client.live.connectWithToken(token);

live.on("connected", () => {
  live.subscribeTelemetry({
    id: "temp",
    deviceIdentifier: "cameradevice9",
    keys: ["temperature"],
  });
});

live.on("telemetry", (event) => {
  console.log(latest.data, "→", event.data);
});

live.connect();

Related packages

| Package | Use case | | --- | --- | | @empa-electronics/tiremo-sdk-client-node | Node.js 18+ | | tiremo-sdk-client | Python |

License

ISC — Empa Electronics