Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mqemitter

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mqemitter

An Opinionated Message Queue with an emitter-style API

  • 0.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
151K
decreased by-19.34%
Maintainers
1
Weekly downloads
 
Created

What is mqemitter?

The 'mqemitter' npm package is a simple message queue emitter that allows you to publish and subscribe to messages. It is designed to be lightweight and easy to use, making it suitable for applications that require basic message queuing and event handling.

What are mqemitter's main functionalities?

Publishing Messages

This feature allows you to publish messages to a specific topic. The code sample demonstrates how to create an instance of MQEmitter and publish a message with a topic and payload.

const MQEmitter = require('mqemitter');
const emitter = MQEmitter();

emitter.emit({ topic: 'myTopic', payload: 'Hello, World!' }, (err) => {
  if (err) {
    console.error('Error publishing message:', err);
  } else {
    console.log('Message published successfully');
  }
});

Subscribing to Messages

This feature allows you to subscribe to messages on a specific topic. The code sample shows how to set up a subscription to a topic and handle incoming messages.

const MQEmitter = require('mqemitter');
const emitter = MQEmitter();

emitter.on('myTopic', (message, cb) => {
  console.log('Received message:', message.payload);
  cb();
});

Unsubscribing from Messages

This feature allows you to unsubscribe from messages on a specific topic. The code sample demonstrates how to remove a previously set up subscription.

const MQEmitter = require('mqemitter');
const emitter = MQEmitter();

const handler = (message, cb) => {
  console.log('Received message:', message.payload);
  cb();
};

emitter.on('myTopic', handler);

// Later, to unsubscribe
emitter.removeListener('myTopic', handler);

Other packages similar to mqemitter

Keywords

FAQs

Package last updated on 12 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc