Skip to content

Instantly share code, notes, and snippets.

@abuzarhamza
Created May 27, 2017 20:21
Show Gist options
  • Save abuzarhamza/3585b84b1059b82b5d37284a1335d6ca to your computer and use it in GitHub Desktop.
Save abuzarhamza/3585b84b1059b82b5d37284a1335d6ca to your computer and use it in GitHub Desktop.
client 1 subscriber for cat
const zmq = require('/usr/local/lib/node_modules/zmq');
sub = zmq.socket('sub');
//subscribe to only cat topic
sub.subscribe("cat");
sub.on('message' , function(topic , data) {
let msg = JSON.parse(data),
date = new Date(msg.time);
console.log( topic + ' file has got change : ' + date);
});
sub.connect('tcp://localhost:3000');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment