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

botsilo

v2.0.8

Published

botsilo mqtt

Readme

botsilo

MQTT bot primitives for direct messaging, broadcasts, and tag channels under a per-user namespace.

What it does

  • Bot class (bot.js) connects with persistent sessions (MQTT 5 + max session expiry) and subscribes to <username>/broadcast/#, <username>/send/<clientId>/#, and any followed tag topics.
  • Emits connect, offline, error, message ({ payload, from }), broadcast ({ payload, from }), and tag ({ payload, tag, from }). Payloads are normalized objects: { type: 'text' | 'json', content, timestamp } plus optional tags/mentions arrays on text payloads.
  • Helpers: bot.send(targetId, data), bot.broadcast(data), bot.publishTag(tag, data), bot.follow(tag). Send/broadcast/tag calls auto-wrap strings into { type: 'text' } payloads (auto-extracting tags and mentions, and stripping them from the content) and objects into { type: 'json' } payloads, adding a timestamp. Broadcasts fan-out #tags to tag topics and @mentions to direct topics when the original data is a string.
  • Demos: interactive CLI (botsilo bin) that connects a bot and broadcasts what you type.

Prereqs

  • Node.js 18+ (uses the built-in test runner and modern syntax).
  • MQTT broker reachable at mqtt://localhost:1883.
    • Create user credentials (defaults in tests are gg / gg).

Install

  • Library: npm install botsilo
  • Root (bots, CLI, tests): npm install

Using the Bot class

import Bot from 'botsilo';

const botA = new Bot({
  host: 'mqtt://localhost:1883',
  username: 'user',
  password: 'pass',
  clientId: 'bot-a',
});
const botB = new Bot({
  host: 'mqtt://localhost:1883',
  username: 'user',
  password: 'pass',
  clientId: 'bot-b',
});

botA.on('connect', () => console.log('bot-a connected'));
botA.on('message', ({ payload, from }) => console.log('direct from', from, payload.content));
botA.on('broadcast', ({ payload, from }) => console.log('broadcast from', from, payload.content));
botA.on('tag', ({ payload, tag, from }) => console.log(`tag ${tag} from ${from}:`, payload.content));

botA.start();
botB.start();

botA.send(botB.clientId, 'hello bot-b');
botA.broadcast('hello all bots #updates @bot-b'); // fans out to the tag and mention topics too
await Promise.all([botA.follow('updates'), botB.follow('updates')]);
botA.publishTag('news', { headline: 'Botsilo ships formatted payloads' });

CLI client (botsilo)

Interactive REPL that connects a single bot and broadcasts each line you type. Run via npx botsilo (or botsilo if installed globally):

npx botsilo --username gg --clientId bot-a --password gg \
  [--host mqtt://localhost:1883] [--mqttOptions '{"protocolVersion":5}']

Type exit/quit to disconnect. Broadcasts carry #tags and @mentions to the appropriate tag/direct topics automatically.