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

rabbit-communication-adapter

v4.1.8

Published

Usage ---------

Readme

rabbit-communication-adapter

Usage

npm init

npm install git+https://github.com/GamingBattleGround/rabbit-communication-adapter.git

To use it in a gbg microservice, you will need to add env variables,

RABBIT_URI=***************
REDIS_URI=**************
ENV=dev
MICROSERVICE=chat/notifications...

and use them like this:

//use case: echo the message to the user

require('dotenv').load();
var Rabbit = require('rabbit-communication-adapter')
var rabbit = new Rabbit(process.env.RABBIT_URI, "microserviceQueueName", peers)

//gateway forwarded the users request, here you can catch the event
rabbit.emitter.on('event from user',(payload, userId)=>{
//do something with data
})

//this is how we send the message, where "ResEvent" is the event name that user is listening to   
   rabbit.sendToUser("event from ms", payload, userId)

To test a simple user behaviour, you can start a client:

//connectiong to our gateway
var io_client = require('socket.io-client')
var client = io_client.connect('https://gbg-gateway-dev.herokuapp.com')

//client logs in
client.emit('user logged in', 47)

//client emits event
setTimeout(()=>{
    client.emit('chat', 'event from user', 'payload', 47)
},1500)

//here client receives an event from microservice
client.on('event from ms',(payload) => {
    console.log("echo: " + payload)
})

If you want to send a message to a microservice with a delay, you should add array of peers as the third parameter to the constructor (in this case, the receiver and sender are the same microservice):

require('dotenv').load();
var Rabbit = require('rabbit-communication-adapter')
var rabbit = new Rabbit(process.env.RABBIT_URI, "matchlobby", ["matchlobby"])
//setTimeout is there to let the constructor finish its work before trying to use methods defined in a class
setTimeout(()=>{
    rabbit.sendToMicroservice("matchlobby", "hello", "payload", 10000)    
},3000)

rabbit.emitter.on('hello', (payload)=>{
   console.log("event from ms", payload)
})

Notes

For simulating client, you will need to install socket.io. Be careful not to commit it since it's dev dependency only.

Logging

If you want to log incomming and outgoing messages in a microservice, add DEBUG = true to .env Also note that log output is tagged. [Rx] is received message, [TxU] is transmitting to user and [TxM] is transmitting to a microservice