lib/session/channels.js
function(names, cb) {
      if (!cb) {
        cb = function() {};
      }
      if (!session.channels) {
        session.channels = [];
      }
      forceArray(names).forEach(function(name) {
        if (session.channels.indexOf(name) === -1) { // clients can only join a channel once
          session.channels.push(name);
          return ss.log.info('i'.green + ' subscribed sessionId '.grey + session.id + ' to channel '.grey + name);
        }
      });
      this._bindToSocket();
      return session.save(cb);
    }
function(names, cb) {
      if (!cb) {
        cb = function() {};
      }
      if (!session.channels) {
        session.channels = [];
      }
      forceArray(names).forEach(function(name) {
        if (session.channels.indexOf(name) === -1) { // clients can only join a channel once
          session.channels.push(name);
          return ss.log.info('i'.green + ' subscribed sessionId '.grey + session.id + ' to channel '.grey + name);
        }
      });
      this._bindToSocket();
      return session.save(cb);
    }
function ( names , cb ) { if ( ! cb ) { cb = function ( ) { } ; } if ( ! session . channels ) { session . channels = [ ] ; } forceArray ( names ) . forEach ( function ( name ) { if ( session . channels . indexOf ( name ) === - 1 ) { // clients can only join a channel once session . channels . push ( name ) ; return ss . log . info ( 'i' . green + ' subscribed sessionId ' . grey + session . id + ' to channel ' . grey + name ) ; } } ) ; this . _bindToSocket ( ) ; return session . save ( cb ) ; }
Subscribes the client to one or more channels
Subscribes the client to one or more channels