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

@ali39/radar-client

v0.1.1

Published

Client SDK for pushing logs and metrics to a Radar server over an access-key-authenticated socket.

Readme

radar-client

Client SDK for pushing logs and metrics to a Radar server over its access-key-authenticated ingestion socket (/socket/api/v1).

Install

npm install @ali39/radar-client

Usage

import { RadarClient } from "radar-client";

const radar = new RadarClient({
    url: "https://radar.example.com",
    accessKey: "<plaintext access key>",
});

radar.info("server started", { pid: process.pid });
radar.error("payment failed", { orderId: "abc123" });

radar.metric("cpu.usage", 42.5, { host: "web-1" });
radar.metric("requests.count", 1);

radar.on("error", (err) => console.error("radar error:", err));

// on shutdown
await radar.close();

Behavior

  • Entries are queued in memory and flushed in batches (default every 2s, up to 500 entries per push - matching the server's own cap).
  • Reconnection is handled by socket.io itself, retried forever by default with exponential backoff (tunable via reconnectionDelay, reconnectionDelayMax, reconnectionAttempts). On every successful (re)connect, whatever piled up while offline is drained automatically.
  • Nothing is lost on disconnect. Entries keep queuing while offline (bounded by maxQueueSize per queue; beyond that the oldest entries are dropped and a "drop" event fires). If a batch is in flight when the socket drops, or the server never acknowledges it within ackTimeout, it is put back on the front of the queue and retried later - it is not lost.
  • Only a batch the server explicitly rejects (e.g. malformed entries) is dropped rather than retried, since retrying identical bad data would fail forever. An "error" event fires either way so you can observe it.
  • close() flushes any remaining queued entries (best-effort, bounded by a timeout) before disconnecting.

Options

| Option | Default | Description | | ------------------------ | -------------------- | ----------------------------------------------------- | | url | required | Radar server base URL | | accessKey | required | Plaintext access key | | path | /socket/api/v1 | Ingestion socket.io path | | flushInterval | 2000 | Flush interval in ms | | maxBatchSize | 500 | Max entries per push (capped at 500) | | maxQueueSize | 10000 | Max entries held per queue while disconnected | | minLevel | debug | Discard logs below this level before queuing | | autoConnect | true | Connect immediately on construction | | reconnection | true | Auto-reconnect on disconnect | | reconnectionDelay | 1000 | Delay before the first reconnection attempt (ms) | | reconnectionDelayMax | 5000 | Upper bound for reconnection backoff (ms) | | reconnectionAttempts | Infinity | Max reconnection attempts before giving up | | ackTimeout | 10000 | How long to wait for a push ack before requeuing (ms) | | rejectUnauthorized | true | Set false to accept self-signed TLS certificates |

Events

  • "connect" - socket connected (fires again after every reconnect)
  • "disconnect" (reason) - socket disconnected
  • "reconnect_attempt" (attempt) - a reconnection attempt is starting
  • "reconnect_failed" - reconnectionAttempts was exhausted; giving up
  • "error" (Error) - connection error, an ack timeout/disconnect mid-push, or a rejected push batch
  • "flush" ({ kind, inserted }) - a batch was accepted by the server
  • "drop" (count) - entries dropped because the queue was full