lib/js/Server.js
function(callback) {
      callback = callback || function(){};
      var t = this,
          server = t.get('server'),
          port = t.get('port'),
          allowExternalConnections = t.get('allowExternalConnections');

      // Allow connections from INADDR_ANY or LOCALHOST only
      var host = allowExternalConnections ? '0.0.0.0' : '127.0.0.1';

      // Start listening
      server.listen(port, host, function(){

        // Allow the UI server to be a Monitor gateway server
        t.monitorServer = new Monitor.Server({server:server, gateway: true});
        t.monitorServer.start(function(){

          // Called after the site object is loaded
          var onSiteLoad = function(error) {
            if (error) {
              return callback(error);
            }

            // Discover and initialize application modules
            t.loadApps();

            // Bind server events
            t._bindEvents(callback);
          };

          // Load and keep the web site object updated
          t.site = new Site();
          t.site.fetch({liveSync: true, silenceErrors:true}, function(error) {

            // Initialize the site if it's not found
            if (error && error.code === 'NOTFOUND') {
              t.site = new Site();
              t.site.id = null;  // This causes a create vs. update on save
              return t.site.save({}, {liveSync: true}, onSiteLoad);
            } else if (error) {
              return onSiteLoad(error);
            }

            // Bind server events once connected
            onSiteLoad();
          });
        });
      });
    }
function(callback) {
      callback = callback || function(){};
      var t = this,
          server = t.get('server'),
          port = t.get('port'),
          allowExternalConnections = t.get('allowExternalConnections');

      // Allow connections from INADDR_ANY or LOCALHOST only
      var host = allowExternalConnections ? '0.0.0.0' : '127.0.0.1';

      // Start listening
      server.listen(port, host, function(){

        // Allow the UI server to be a Monitor gateway server
        t.monitorServer = new Monitor.Server({server:server, gateway: true});
        t.monitorServer.start(function(){

          // Called after the site object is loaded
          var onSiteLoad = function(error) {
            if (error) {
              return callback(error);
            }

            // Discover and initialize application modules
            t.loadApps();

            // Bind server events
            t._bindEvents(callback);
          };

          // Load and keep the web site object updated
          t.site = new Site();
          t.site.fetch({liveSync: true, silenceErrors:true}, function(error) {

            // Initialize the site if it's not found
            if (error && error.code === 'NOTFOUND') {
              t.site = new Site();
              t.site.id = null;  // This causes a create vs. update on save
              return t.site.save({}, {liveSync: true}, onSiteLoad);
            } else if (error) {
              return onSiteLoad(error);
            }

            // Bind server events once connected
            onSiteLoad();
          });
        });
      });
    }
function ( callback ) { callback = callback || function ( ) { } ; var t = this , server = t . get ( 'server' ) , port = t . get ( 'port' ) , allowExternalConnections = t . get ( 'allowExternalConnections' ) ; // Allow connections from INADDR_ANY or LOCALHOST only var host = allowExternalConnections ? '0.0.0.0' : '127.0.0.1' ; // Start listening server . listen ( port , host , function ( ) { // Allow the UI server to be a Monitor gateway server t . monitorServer = new Monitor . Server ( { server : server , gateway : true } ) ; t . monitorServer . start ( function ( ) { // Called after the site object is loaded var onSiteLoad = function ( error ) { if ( error ) { return callback ( error ) ; } // Discover and initialize application modules t . loadApps ( ) ; // Bind server events t . _bindEvents ( callback ) ; } ; // Load and keep the web site object updated t . site = new Site ( ) ; t . site . fetch ( { liveSync : true , silenceErrors : true } , function ( error ) { // Initialize the site if it's not found if ( error && error . code === 'NOTFOUND' ) { t . site = new Site ( ) ; t . site . id = null ; // This causes a create vs. update on save return t . site . save ( { } , { liveSync : true } , onSiteLoad ) ; } else if ( error ) { return onSiteLoad ( error ) ; } // Bind server events once connected onSiteLoad ( ) ; } ) ; } ) ; } ) ; }
Start the UI server

This method starts listening for incoming UI requests.

@method start
@param [callback] {Function(error)} - Called when the server has started
 
The server has started

This event is fired when the server has begun listening for incoming
web requests.

@event start
 
A client error has been detected

This event is fired if an error has been detected in the underlying
transport.  It may indicate message loss.

@event error
Start the UI server