lib/smartrouter.js
function (config) {
    logger.info(util.format('Starting SmartRouter... Will listen on port %s', config.port));
    logger.info(util.format('Using https: %s', CONFIG.https.use));
    logger.info(util.format('RabbitMQ url is set to %s', config.amqp.url));
    logger.debug('Max Channel per RabbitMQ Connection: ', this.MAX_CHANNEL_PER_CONNECTION);
    var self = this;
    self.config = config;
    self.reconnectDelay = CONFIG.rabbitmqReconnectDelay || 10000;
    self.delayBeforeDeletingInactiveQueue = CONFIG.delayBeforeDeletingInactiveQueue || (15 * 60 * 1000); // 15min by default
    logger.info('Delay before deleting inactive queues: ' + self.delayBeforeDeletingInactiveQueue);

    self.amqp = self._createAmqpConnection();

    self.amqp.once('ready', function() {
      logger.info('Starting Socket.IO server...');
      if (CONFIG.https.use) {
        var options = {
          pfx: fs.readFileSync(CONFIG.https.pfx_path),
          passphrase: CONFIG.https.pfx_passphrase
        };
        self.io = Io.listen(https.createServer(options).listen(+config.port));
      }
      else {
        self.io = Io.listen(+config.port);
      }
      self._configureIo();
      self.registerEndpoints();
      self.listenForNewEndpoints();
      self.started = true;
      self.emit('started');
    });
  }
function (config) {
    logger.info(util.format('Starting SmartRouter... Will listen on port %s', config.port));
    logger.info(util.format('Using https: %s', CONFIG.https.use));
    logger.info(util.format('RabbitMQ url is set to %s', config.amqp.url));
    logger.debug('Max Channel per RabbitMQ Connection: ', this.MAX_CHANNEL_PER_CONNECTION);
    var self = this;
    self.config = config;
    self.reconnectDelay = CONFIG.rabbitmqReconnectDelay || 10000;
    self.delayBeforeDeletingInactiveQueue = CONFIG.delayBeforeDeletingInactiveQueue || (15 * 60 * 1000); // 15min by default
    logger.info('Delay before deleting inactive queues: ' + self.delayBeforeDeletingInactiveQueue);

    self.amqp = self._createAmqpConnection();

    self.amqp.once('ready', function() {
      logger.info('Starting Socket.IO server...');
      if (CONFIG.https.use) {
        var options = {
          pfx: fs.readFileSync(CONFIG.https.pfx_path),
          passphrase: CONFIG.https.pfx_passphrase
        };
        self.io = Io.listen(https.createServer(options).listen(+config.port));
      }
      else {
        self.io = Io.listen(+config.port);
      }
      self._configureIo();
      self.registerEndpoints();
      self.listenForNewEndpoints();
      self.started = true;
      self.emit('started');
    });
  }
function ( config ) { logger . info ( util . format ( 'Starting SmartRouter... Will listen on port %s' , config . port ) ) ; logger . info ( util . format ( 'Using https: %s' , CONFIG . https . use ) ) ; logger . info ( util . format ( 'RabbitMQ url is set to %s' , config . amqp . url ) ) ; logger . debug ( 'Max Channel per RabbitMQ Connection: ' , this . MAX_CHANNEL_PER_CONNECTION ) ; var self = this ; self . config = config ; self . reconnectDelay = CONFIG . rabbitmqReconnectDelay || 10000 ; self . delayBeforeDeletingInactiveQueue = CONFIG . delayBeforeDeletingInactiveQueue || ( 15 * 60 * 1000 ) ; // 15min by default logger . info ( 'Delay before deleting inactive queues: ' + self . delayBeforeDeletingInactiveQueue ) ; self . amqp = self . _createAmqpConnection ( ) ; self . amqp . once ( 'ready' , function ( ) { logger . info ( 'Starting Socket.IO server...' ) ; if ( CONFIG . https . use ) { var options = { pfx : fs . readFileSync ( CONFIG . https . pfx_path ) , passphrase : CONFIG . https . pfx_passphrase } ; self . io = Io . listen ( https . createServer ( options ) . listen ( + config . port ) ) ; } else { self . io = Io . listen ( + config . port ) ; } self . _configureIo ( ) ; self . registerEndpoints ( ) ; self . listenForNewEndpoints ( ) ; self . started = true ; self . emit ( 'started' ) ; } ) ; }
start: starts the SmartRouter
start : starts the SmartRouter