1.1.0 • Published 6 years ago
commsvc v1.1.0
Communication Service
commsvc is a simple events-based communication service that consists on listen or send events.
Installation & Usage
Installation
commsvc can be installed through npm:
npm install commsvc
Usage
const commsvc = require('commsvc');
console.log('Listening to message_id topic!');
commsvc
.listenTo('message_id')
.subscribe((data) => console.log('message_id received:', data));
setTimeout(() => {
commsvc.send({
topic: 'message_id',
data: 'I\'ll climb the stairs with the missing steps.'
});
}, 5000);
// #output:
// Listening to message_id topic!
// message_id received: I'll climb the stairs with the missing steps.