index.js
function publisher(port) {
  var socket = zeromq.socket('pub');
  socket.identity = 'pub' + process.pid;

  socket.connect(port);
  console.log('publisher connected to ' + port);

  // lets count messages / sec
  var totalMessages=0;
  setInterval(function() {
    console.log('total messages sent = '+totalMessages);
    totalMessages=0;
    // now fire messages
    for(var i=0;i<5000;i++) {
      var value = Math.random()*1000;
      socket.send('log ' + value);
      totalMessages++;
    }
  }, 1000);

}
function publisher(port) {
  var socket = zeromq.socket('pub');
  socket.identity = 'pub' + process.pid;

  socket.connect(port);
  console.log('publisher connected to ' + port);

  // lets count messages / sec
  var totalMessages=0;
  setInterval(function() {
    console.log('total messages sent = '+totalMessages);
    totalMessages=0;
    // now fire messages
    for(var i=0;i<5000;i++) {
      var value = Math.random()*1000;
      socket.send('log ' + value);
      totalMessages++;
    }
  }, 1000);

}
function publisher ( port ) { var socket = zeromq . socket ( 'pub' ) ; socket . identity = 'pub' + process . pid ; socket . connect ( port ) ; console . log ( 'publisher connected to ' + port ) ; // lets count messages / sec var totalMessages = 0 ; setInterval ( function ( ) { console . log ( 'total messages sent = ' + totalMessages ) ; totalMessages = 0 ; // now fire messages for ( var i = 0 ; i < 5000 ; i ++ ) { var value = Math . random ( ) * 1000 ; socket . send ( 'log ' + value ) ; totalMessages ++ ; } } , 1000 ) ; }
lets do the publisher here
lets do the publisher here