Skip to content

Instantly share code, notes, and snippets.

@groundwater
Created October 29, 2012 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save groundwater/3976658 to your computer and use it in GitHub Desktop.
Save groundwater/3976658 to your computer and use it in GitHub Desktop.
Message Buffering Bug
var axon = require('axon')
var PORT1 = 8900;
var PORT2 = 8901;
var push1 = axon.socket('push')
push1.bind(PORT1)
var push2 = axon.socket('push')
push2.bind(PORT2)
var x = 0;
setInterval(function(){
push1.send(JSON.stringify(x))
push2.send(JSON.stringify(x))
x++;
},800)
function run(port){
var pull = axon.socket('pull')
pull.connect(port)
pull.on('message',function(msg){
console.log(JSON.parse(msg))
})
}
setTimeout(function(){
run(PORT2) // Change this to PORT1 for Different Behaviour
},4000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment