Created
May 27, 2017 20:21
-
-
Save abuzarhamza/3585b84b1059b82b5d37284a1335d6ca to your computer and use it in GitHub Desktop.
client 1 subscriber for cat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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