Created
October 29, 2012 21:28
-
-
Save groundwater/3976658 to your computer and use it in GitHub Desktop.
Message Buffering Bug
This file contains hidden or 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 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