-
-
Save siroken3/7b4eac9ae6775dddf623 to your computer and use it in GitHub Desktop.
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
var zmq = require('zeromq'); | |
s = zmq.createSocket('push'); | |
s.connect('tcp://127.0.0.1:15000'); | |
while (true) { // ZOMG he did it again! | |
s.send(new Buffer("test")); | |
} |
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
var zmq = require('zeromq'), | |
util = require('util'), | |
redis = require("redis"), | |
client = redis.createClient(); | |
s = zmq.createSocket('pull'); | |
var count = 0; | |
var time = null; | |
s.bind('tcp://127.0.0.1:15000', function(err) { | |
if (err) throw err; | |
s.on('message', function(data) { | |
client.lpush('q', data.toString()); | |
count++; | |
if (count == 1) { | |
time = new Date(); | |
} | |
if ((count % 10000) === 0) { | |
var t = new Date(); | |
console.log('T: ' + ((t-time)/1000)); | |
time = t; | |
} | |
}); | |
util.puts('Server is up ...'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment