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 🙏

© 2025 – Pkg Stats / Ryan Hefner

kalm

v8.1.1

Published

The socket optimizer

Readme

  • Easy-to-use syntax unified across protocols
  • Flexible and extensible, create your own transports and buffering strategies
  • Can be used between servers or in the browser
  • Lower resource footprint and better throughput than plain sockets
  • Zero dependencies and can be bundled down to ~5kb!

Performance

The performance gain comes from buffering packets before sending them- eventually sending batches instead of individual packages. The more traffic getting processed, the better the improvement. Many strategies are offered as routines. You can read more about the packet buffering algorithm here

Install

Install the core package

npm install kalm

Install the transport layer ('tcp' for example)

npm install @kalm/tcp

Usage

Server

const kalm = require('kalm');
const ws = require('@kalm/ws');

const server = kalm.listen({
  port: 8800,
  transport: ws(),
  routine: kalm.routines.tick({ hz: 5 }), // Sends packets at a frequency of 5 Hz (200ms)
  host: '0.0.0.0',
});

server.on('connection', (client) => {
  client.subscribe('channel1', (body, context) => {
    // When receiving messages from this client on "channel1"
    console.log(body) //
    console.log(context) //
  });

  // Sends a message to all clients on "channel2"
  server.broadcast('channel2', 'some message');
});

Client

const kalm = require('kalm');
const ws = require('@kalm/ws');

const client = kalm.connect({
  host: '0.0.0.0',
  port: 8800,
  transport: ws(),
  routine: kalm.routines.realtime(),
  // socket: new WebSocket(...), // You can also pass a socket object, which unlocks compatibility with many other libraries, like https://github.com/joewalnes/reconnecting-websocket
});

client.on('connect', () => {
  client.subscribe('channel1', (body, context) => {
    // When receiving messages from the server on "channel1"
    console.log(body); // 
    console.log(context); //
  });

  // Sends a message to the server on "channel2"
  client.write('channel2', 'hello world');
});

To see working implementations, check out our examples folder.

Documentation

[Read more]

Logging

Kalm uses the NODE_DEBUG environment variable. Just include kalm in your value.

Example:

NODE_DEBUG=net,kalm node myApp.js

Events

Kalm servers offers events to track when packets are processed by routines or when a raw frame is received.

| Server Event | Payload | Description | | --- | --- | --- | | error | Error | (server, client) Emits on errors. | | ready | void | (server) Indicates that the server is now actively listening for new connections | | connection | Client | (server) Indicates that a client has successfully connected |

Kalm clients offers events to track when packets are processed by routines or when a raw frame is received.

| Client Event | Payload | Description | | --- | --- | --- | | error | Error | (server, client) Emits on errors. | | connect | void | (client) Indicates that a client has successfully connected | | disconnect | void | (client) Indicates that a client has disconnected | | frame | { body: Partial<RawFrame>, payloadBytes: number } | (client) Triggered when receiving payloads, can be used to intercept messages from non-kalm counterparts. |

Testing

npm test

npm run bench

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

If you think of something that you want, open an issue or file a pull request, we'll be more than happy to take a look!

License

Apache 2.0 2025 Frederic Charette