1.1.4 • Published 4 years ago
nats-promisify v1.1.4
Promise-based library for NATS
A simple promise-based library for NATS
Installation
Install via NPM:
npm install nats-promisify
Usage
Require nats-promisify
const nats = require('nats-promisify');
Publish a message
nats.publish('k1', 'hello')
.then(console.log)
.catch(console.error);
nats.on('k1')
.then((data)=>console.log('message', data.msg))
.catch(console.error);
Emit a message and get acknowledgment
nats.emit('k2', 'hello')
.then((resp)=>console.log('response', resp))
.catch(console.error);
nats.on('k2')
.then((data)=>{
console.log('message', data.msg);
nats.publish(data.reply, 'good job!');
})
.catch(console.error);
Bugs and Issues
If you encounter any bugs or issues, feel free to open an issue at github.
License
Copyright © 2019, Aram Manukyan.
All rights reserved.