local-mq
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Local MQ

simple local message queue using event emitter.

you can use this library for mocking mqtt or amqp.

Install

$npm i local-mq

Usage

  1. import library
  2. call getInstance()
  3. call subscribe(), publish()
const localMQ = require('local-mq');

const mq = localMQ.MQ.getInstance();

const event = {
  key: 'session.created',
  args: {
    name: 'vincent',
    role: 'prototype.engineer',
  }
}

mq.subscribe('session.#', async(ev) => console.log(ev));
mq.subscribe('session.created', async(ev) => console.log(ev));

mq.publish(event);

Readme

Keywords

Package Sidebar

Install

npm i local-mq

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

27.5 kB

Total Files

22

Last publish

Collaborators

  • haandol