1.0.1 • Published 4 years ago
@nbn23/pubsub v1.0.1
PubSub
PubSub is a small generic utility to be used to send and listen messages from and to other agents Currently only supports fire and forget mode. (PUSH)
Getting Started
Install PubSub using npm.
npm install --save @nbn23/pubsub
Note: PubSub assumes a TypeScript environment
Usage
const PubSub = require("@nbn23/pubsub");
const pubSub = new PubSub();
await pubSub.publish("topic", {foo: "bar"});
await pubSub.subscribe("topic", async (message) => {
console.log(message);
});