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

anger

v0.1.6

Published

pub-sub tester for Nes

Downloads

11

Readme

anger

A pub-sub load tester for Nes. Designed to be used to write custom "realworld" like scenarios.

Status: Experimental

Install

npm install --save anger

Usage

To use anger, simply require it, and supply it some test scenario configuration.

const anger = require('anger')

const instance = anger({
  url: 'http://localhost:3000',
  subscription: '/greet', // the 'topic' to pub/sub test
  connections: 1000, // 1000 clients connect
  senders: 2, // 2 clients send messages
  requests: 1000, // 2 clients send 1000 requests
  responses: 10000, // expected number of responses (1000 connections responding to 1000 individual requests)
  identifier: (payload) => payload.meta.id, // used to apply an id to messages in, which matches it to the corresponding request
  trigger: (sender) => { // a function used to send a message to the server
    sender.request({
      method: 'POST',
      path: '/h',
      payload: {
        id: ++uid // this is used to map the responses to the requests
      }
    })
    return uid // must return the uid of the message sent
  }
})

instance.on('end', (result) => {
  // some stats are in result
})

API

anger(opts)

Start an anger instance against a given target.

  • opts: An Object with configuration information. Can contain the following attributes:
    • url: The base url of the hapi/nes server you want to test.
    • subscription: A topic to test.
    • connections: The number of connections to maintain to server. Each is an individual nes client.
    • senders: The number of connections that should be senders.
    • responses: The number of overall expected responses to be recieved during this run.
    • auth: A Function or Object passed to the nes client for authentication. If a Function, it is passed the client and index of that client as params. Must return the auth object options. If an Object, it must be passed the auth object options. auth object reference.
    • identifier: A function used to map some payload response data to a requests uid.
    • trigger: A function which is passed a nes client to emit a message to the server for testing. Must return some uid of a message sent.
    • retryOpts: An object which is passed to try-again to achieve exponential backoff for retries. Check the try-again docs for reference on how to use it.. Default values below:
      • retries: 8
      • max: 10000
      • jitter: 0.2
      • factor: 2
      • min: 100

Returns an instance/event emitter for tracking progress, etc.

anger events

Because an anger instance is an EventEmitter, it emits several events. these are below:

  • error: emitted on a error. The callback function will receive the error as the first parameter.
  • connect: emitted when all clients are connected to the server.
  • subscribe: emitted when all clients are subscribed to the server.
  • trigger: emitted when a sender is sending a 'request' message. The callback function will receive the requests uid as the first parameter.
  • publish-events-recieved: emitted when all connections receive the message 'response' sent from the server, in response to some triggered 'request'. The callback should receive the uid for the event that triggered it.
  • end: emmited when testing finishes, with the result passed as the first parameter to the callback.

Sample

Check out the examples folder for a simple sample.

License

MIT. Copyright (c) Matteo Collina and David Mark Clements 2016.