function PubSub (pub, sub) {
  events.EventEmitter.call(this);
  var self = this;

  //create a redis socket for publishing and connect to address and port
  this.pub = pub || redis.createClient();

  //create a redis socket for subscribing and connect to address and port
  this.sub = sub || redis.createClient();

  //when we receive a message from the subscription socket have us emit a "message" event
  this.sub.on('message', function (channel, message) {
    //TODO update this
    self.emit('message', String(channel + ' ' + message));
  });
}
function PubSub (pub, sub) {
  events.EventEmitter.call(this);
  var self = this;

  
  this.pub = pub || redis.createClient();

  
  this.sub = sub || redis.createClient();

  
  this.sub.on('message', function (channel, message) {
    
    self.emit('message', String(channel + ' ' + message));
  });
}
function PubSub ( pub , sub ) { events . EventEmitter . call ( this ) ; var self = this ; //create a redis socket for publishing and connect to address and port this . pub = pub || redis . createClient ( ) ; //create a redis socket for subscribing and connect to address and port this . sub = sub || redis . createClient ( ) ; //when we receive a message from the subscription socket have us emit a "message" event this . sub . on ( 'message' , function ( channel , message ) { //TODO update this self . emit ( 'message' , String ( channel + ' ' + message ) ) ; } ) ; }
/*
We use the PubSub to publish messages to everyone that is subscribed
/ * We use the PubSub to publish messages to everyone that is subscribed