InsFrame.js
function() {
      // locale InsFrame root folder
      homeFolder = __dirname;
      console.log("   info  -".cyan, "InsFrame root".yellow, homeFolder);

      // express config
      app.set("view engine", "ejs");
      app.set("views", homeFolder + "/views");
      app.set("views");
      app.set("view options", { layout: null });

      // static resources
      app.use("/js", express.static(homeFolder + "/js"));
      app.use("/css", express.static(homeFolder + "/css"));
      app.use("/images", express.static(homeFolder + "/images"));

      // port
      port = this.port || parseInt(process.argv[2]) || PORT;

      // Timer to send close requests when timeout occurs.
      setInterval(function() {
        for (var id in urlData) {
          urlData[id].timeout -= CHECK_INTERVAL;
          if (urlData[id].timeout <= 0) {
            io.sockets.emit("close", { id: id, url: urlData[id].url });
            console.log("   info  -".cyan, "close/timeout".yellow, JSON.stringify(urlData[id]));
            delete urlData[id];
          }
        }
      }, CHECK_INTERVAL);
    }
function() {
      // locale InsFrame root folder
      homeFolder = __dirname;
      console.log("   info  -".cyan, "InsFrame root".yellow, homeFolder);

      // express config
      app.set("view engine", "ejs");
      app.set("views", homeFolder + "/views");
      app.set("views");
      app.set("view options", { layout: null });

      // static resources
      app.use("/js", express.static(homeFolder + "/js"));
      app.use("/css", express.static(homeFolder + "/css"));
      app.use("/images", express.static(homeFolder + "/images"));

      // port
      port = this.port || parseInt(process.argv[2]) || PORT;

      // Timer to send close requests when timeout occurs.
      setInterval(function() {
        for (var id in urlData) {
          urlData[id].timeout -= CHECK_INTERVAL;
          if (urlData[id].timeout <= 0) {
            io.sockets.emit("close", { id: id, url: urlData[id].url });
            console.log("   info  -".cyan, "close/timeout".yellow, JSON.stringify(urlData[id]));
            delete urlData[id];
          }
        }
      }, CHECK_INTERVAL);
    }
function ( ) { // locale InsFrame root folder homeFolder = __dirname ; console . log ( "   info  -" . cyan , "InsFrame root" . yellow , homeFolder ) ; // express config app . set ( "view engine" , "ejs" ) ; app . set ( "views" , homeFolder + "/views" ) ; app . set ( "views" ) ; app . set ( "view options" , { layout : null } ) ; // static resources app . use ( "/js" , express . static ( homeFolder + "/js" ) ) ; app . use ( "/css" , express . static ( homeFolder + "/css" ) ) ; app . use ( "/images" , express . static ( homeFolder + "/images" ) ) ; // port port = this . port || parseInt ( process . argv [ 2 ] ) || PORT ; // Timer to send close requests when timeout occurs. setInterval ( function ( ) { for ( var id in urlData ) { urlData [ id ] . timeout -= CHECK_INTERVAL ; if ( urlData [ id ] . timeout <= 0 ) { io . sockets . emit ( "close" , { id : id , url : urlData [ id ] . url } ) ; console . log ( "   info  -" . cyan , "close/timeout" . yellow , JSON . stringify ( urlData [ id ] ) ) ; delete urlData [ id ] ; } } } , CHECK_INTERVAL ) ; }
Setting up environment
Setting up environment