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

@blueyerobotics/blueye-ts

v5.0.18

Published

A TypeScript client for interacting with Blueye underwater drones.

Readme

blueye-ts

A TypeScript package for interacting with Blueye underwater drones and parsing binlog files.

Installation

npm install @blueyerobotics/blueye-ts

Usage

import { BlueyeClient } from "@blueyerobotics/blueye-ts";

const client = new BlueyeClient();

client.on("connected", async () => {
  // request battery information
  const batteryRep = await client.sendRequest("GetBatteryReq");
  console.log("batteryRep:", batteryRep);

  // get latest battery telemetry
  const batteryTel = await client.getTelemetry("BatteryTel");
  console.log("batteryTel:", batteryTel);

  // send a control message to change the light intensity to 1
  await client.sendControl("LightsCtrl", { lights: { value: 1 } });
});

// subscribe to battery telemetry updates
client.on("BatteryTel", data => {
  console.log("received BatteryTel:", data);
});

client.connect();

Connection states

BlueyeClient manages four sockets: sub, rpc, pub, and sonar. Global state events (connecting, connected, disconnected) are emitted when the derived state changes. Per-socket events use the ${socket}-${state} format (e.g. sonar-connected, rpc-connecting):

client.on("connected", () => {
  console.log("all required sockets ready");
});

client.on("sonar-connected", () => {
  console.log("sonar socket ready");
});

The derived client.state reflects the aggregate of the core sockets (sub, rpc, pub). If a multibeam sonar is detected via DroneInfoTel, the sonar socket is also required for connected.

  • disconnected: connect() has not been called.
  • connecting: one or more required sockets are not yet ready.
  • connected: all required sockets are ready — safe to call sendRequest(), getTelemetry(), and sendControl().

All state events — global and per-socket — are edge-triggered: they fire exactly once per actual change. If the client loses one or more sockets after being connected, the derived state moves back to connecting (with a connecting event). sendRequest() and sendControl() reject unless the client is in the connected state.

Telemetry staleness watchdog

A dead link does not always produce a close event — a tether or radio drop can leave the sockets looking connected while telemetry silently freezes, until TCP retransmission gives up minutes later. Because the drone publishes telemetry continuously (e.g. DroneTimeTel at 1 Hz), the client watches for it: if no message arrives on the telemetry socket for stalenessTimeout milliseconds (default 5000) while connected, the client force-drops its connections. This converts the silent failure into the normal loss path — consumers see the usual connecting event, and the built-in reconnect loop restores the session when the link returns.

The watchdog only arms after the first telemetry message of a connection (a connection that never produced telemetry is not judged stale), watches the main telemetry socket only (sonar can be legitimately quiet), and disarms on disconnect(). Set stalenessTimeout: 0 to disable it:

const client = new BlueyeClient({ stalenessTimeout: 0 }); // no watchdog

Transports

BlueyeClient talks to its sockets through a small transport interface. The default adapter uses jszmq over WebSockets; an in-memory adapter ships alongside it for tests, so application code using BlueyeClient can be exercised without a drone or any network:

import { BlueyeClient, InMemoryTransport } from "@blueyerobotics/blueye-ts";

const transport = new InMemoryTransport();
const rpc = transport.listen("mem://rpc");
rpc.onMessage(([topic, payload], reply) => {
  // inspect the request, reply([topic, encoded]) as the drone would
});
transport.listen("mem://sub");
transport.listen("mem://pub");
transport.listen("mem://sonar");

const client = new BlueyeClient({
  subUrl: "mem://sub",
  rpcUrl: "mem://rpc",
  pubUrl: "mem://pub",
  sonarUrl: "mem://sonar",
  transport,
});

When you are done with a client, call client.close() to release the underlying sockets permanently; a closed client cannot be reused.

Sonar support

BlueyeClient connects the sonar websocket endpoint at ws://192.168.1.101:9988 when a supported multibeam device is detected in a DroneInfoTel message.

  • On connect(), the sonar socket subscribes but only connects when a known multibeam device ID is found in the guest-port device list. Detection inspects every DroneInfoTel — one is requested over RPC when the connection comes up, and any later DroneInfoTel arriving over SUB is also considered.
  • Once detected, the sonar socket connects and the global connected state requires it to be ready. Detection resets on disconnect(); the next connection starts without requiring sonar until it is detected again.
  • Sonar telemetry such as MultibeamPingTel, MultibeamConfigTel, and MultibeamDiscoveryTel is emitted through the same typed event interface as other telemetry messages.