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

callosum-client-tcp-rover

v0.1.0

Published

TCP client rover for Callosum: a self-balancing distributed services protocol

Readme

callosum-client-tcp-rover

Stability: 1 - Experimental

NPM version

TCP Client rover for Callosum: a self-balancing distributed services protocol.

Usage

var ClientRover = require('callosum-client-tcp-rover');
var clientRover = new ClientRover({
    ROVING_INTERVAL: 1000, // milliseconds
    servers: {
        'localhost:4040': {host: 'localhost', port: 4040},
        'localhost:4041': {host: 'localhost', port: 4041}
    }
});

clientRover.on('error', function (error) {
    console.log(error); 
});

clientRover.on('unreachable', function (id, server) {
    console.log('server with id ' + id + ' is unreachable');
    console.dir(server); // for example: {host: 'localhost', port: 4041}
});

clientRover.on('connection', function (slot, socket) {
    console.log('new connection with slot number ' + slot);
    // keep socket open or close it depending on client configuration and slot
});

// start requesting connections from servers every ROVING_INTERVAL
clientRover.start(); 

// add additional servers as they become available
clientRover.addServer('localhost:4042', {host: 'localhost', port: 4042});

// remove servers by id
clientRover.dropServer('localhost:4042');

Tests

npm test

Overview

TCP Client rover for Callosum: a self-balancing distributed services protocol.

The rover maintains a list of servers it was given (with follow-on updates) and every ROVING_INTERVAL selects a server at random to connect to. Upon connection, as dictated by the Callosum TCP Server Protocol, a slot number will be sent to the rover from the server. For example, for slot 13:

13\r\n

The rover will parse this slot number and then emit a connection event with the slot and the socket. It is then up to the TCP Client to decide whether the connection should be kept or not. Rover no longer maintains knowledge of it and goes to sleep until woken up again according to ROVING_INTERVAL.

Documentation

CallosumClientRover

Public API

new CallosumClientRover(options)

  • options: Object
    • ROVING_INTERVAL: Integer (Default: 1000) Interval in milliseconds between connection attempts.
    • servers: Object (Default: {}) Map, by id, of servers to initialize with.

Creates a new CallosumClientRover instance.

callosumClientRover.addServer(id, server)

  • id: String Server identifier.
  • server: Object
    • host: String Host.
    • port: Integer Port.

Adds the server to be considered for new connections.

callosumClientRover.connect()

CAUTION: reserved for internal use

Executes a connection attempt to a random server.

callosumClientRover.dropServer(id)

  • id: String Server identifier.

Removes the server from being selected for new connections.

callosumClientRover.start()

Immediately attempts to connect to a random Callosum server and then continues the attempts every ROVING_INTERVAL.

Event connection

  • function (slot, socket) {}
    • slot: Integer Slot number for this connection.
    • socket: Socket object The socket object for this connection.

Emitted when a successful connection to a random server is made.

Event error

  • function (error) {}
    • error: Object An error that occurred.

Emitted when CallosumClientRover encounters an error. If no handler is registered, an exception will be thrown.

Event unreachable

  • function (id, server) {}
    • id: String Id of the server that is unreachable.
    • server: Object
      • host: String Host.
      • port: Integer Port.

Emitted when a connection to a random server is attempted but the server is unreachable.

Sources