code: function forwarder(frontPort, backPort) {
    var frontSocket = zeromq.socket('sub'),
        backSocket = zeromq.socket('pub');
  
    frontSocket.identity = 'sub' + process.pid;
    backSocket.identity = 'pub' + process.pid;
  
    frontSocket.subscribe('');
    frontSocket.bind(frontPort, function (err) {
      console.log('bound', frontPort);
    });
      
    var totalMessages=0;
    frontSocket.on('message', function() {
      //pass to back
      //console.log('forwarder: recasting', arguments[0].toString());
      backSocket.send(Array.prototype.slice.call(arguments));
      totalMessages++;
    });
  
    backSocket.bind(backPort, function (err) {
      console.log('bound', backPort);
    });
  
    // lets count messages forwarded
    setInterval(function() {
      console.log('messages forwarded = ' + totalMessages);
      totalMessages=0;
    }, 1000);
  
  }
docs: create a forwarder device