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 🙏

© 2024 – Pkg Stats / Ryan Hefner

stomp-emitter

v0.1.0

Published

EventEmitter like interface for a stomp client

Downloads

3

Readme

Stomp Emitter Build Status

An EventEmitter like interface for a stomp client

Getting Started

Install the module with: npm install stomp-emitter

Usage

This module expects you to pass in an existing stomp client. The stomp client should follow the same interface of the stomp-client npm module. So either npm install stomp-client --save or create a similar interface.

var client = require('./my-stomp-client-instance.js');
var StompEmitter = require('stomp-emitter');
var emitter = new StompEmitter(client, process.pid); // The client is a fully instantiated stomp-client instance and process.pid is used as the UID.

You may use any UID when initialising the emitter as long as you can ensure that it will be unique among the procsses emitting data to the stomp server.

Emitting global events

To emit an event that may be picked up by any other client, simply emit any event name followed by the raw data. If you wish to emit JSON and have it be processed by another stomp-emitter client instance, provide a third parameter to the emit method with an object key of content-type: application/json':

emitter.emit('my_event', 'THIS IS MY EVENT MESSAGE'); // 'THIS IS MY EVENT MESSAGE' is received by clients subscribed to the my_event event.

emitter.emit('my_json_event', JSON.stringify([1, 2, 3]), { 'content-type': 'application/json' }); // [1, 2, 3] is received by clients subscribed to the my_json_event event.

Emitting local events

Sometimes, you may wish to have events which are only processed within the local process. To restrict events locally, prefix the event name with a tilde character ~ when publishing and subscribing:

emitter.on('~thisislocal', localHandlerFunc);

emitter.emit('~thisislocal', 3.14); // This will only be handled by localHandlerFunc