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

@anzerr/atium.broker

v1.0.42

Published

Light weight in memory message broker.

Downloads

25

Readme

Intro

GitHub Actions status | linter GitHub Actions status | publish GitHub Actions status | test GitHub Actions status | docker

Light weight in memory message broker. There are no stat logging for task. Tasks are run in the order they arrive/complete. There is still work that can be done at the moment it handles around 10k tasks a sec.

Features

  • atomic task execution
  • guarantee task being pooled
  • sub/unsub event message system
  • light weight in memory storage
  • task chaining
  • zero dependencies

How does it work?

  • A worker connects to the broker.
  • He tells the broker he can work.
  • The server pushes a task to the worker it sends a acknowledge back.
  • Runs the task and sends back the output if there's a next/chained task.

Install

npm install --save git+https://[email protected]/anzerr/atium.broker.git

Example of a task


const {Task, Server, Event} = require('atium.broker'),
	Request = require('request.libary');

class TestTask extends Task {

	constructor(c) {
		super({
			...c,
			type: 'default'
		});
		this.store = {};
		this.on('event:done', (msg) => { // sub to done event
			this.store[msg.n] = false;
		});
	}

	run(task) {
		console.log('t', this.who, task);
		this.event('done', {n: task.stuff}); // send event to everyone execpt me
		return Promise.resolve();
	}

}

(() => {
	const config = {
		socket: 'localhost:3001',
		api: 'localhost:3002',
		tasks: ['task_10001']
	};

	const send = (task) => {
		return new Request(`http://${config.api}`).json(task).post('/add');
	};

	let t = null;
	let s = new Server(config); // server
	let e = new TestTask({ // client to receive events no tasks
		socket: config.socket,
		api: config.api,
		tasks: []
	});

	let out = [];
	for (let x = 0; x < 10; x++) {
		e.store[x] = true;
		e.store[x + 100] = true;
		out.push({
			tasks: [ // chain tasks
				{
					task: config.tasks[0], // run this task first
					input: {
						stuff: x
					}
				},
				{
					task: config.tasks[0], // run this task second
					input: {
						stuff: x + 100
					}
				}
			]
		});
	}

	const eventClient = new Event(config); // event client without tasks handling 
	eventClient.init().then(() => {
		eventClient.subscribe('done');

		eventClient.on('event:done', (msg) => {
			console.log(msg);
		});
	});

	e.on('connect', () => {
		e.subscribe('done').then(() => {
			console.log('subscribe to "done"');
			t = new TestTask(config); // task client
			Promise.all([
				new Promise((resolve) => t.on('connect', () => resolve())), // wait for client to connect
				send(out) // send out task creation
			]).then(() => {
				console.log('setup done');
				setTimeout(() => { // dirty close
					for (let i in e.store) {
						if (e.store[i]) {
							console.log('missing', i, 'did not recive event');
						}
					}
					console.log('done task', JSON.stringify(e.store));
					t.close();
					e.close();
					s.close();
				}, 1000);
			});
		});
	});
})();