UNPKG

@steelbreeze/broker

Version:

Lightweight publish and subscribe using Server-Sent Events for node and express

9 lines (7 loc) 331 B
const broker = require('@steelbreeze/broker'); // create a client to the message broker var client = broker.client({host:'localhost', port: 1024, path: '/events'}); // subscribe to the devices topic on the /events broker client.subscribe('devices', (message) => { console.log(`All devices: (${message.id}) ${message.data}`); });