var HISTORY_TO_KEEP = 5;
var MINIMUM_VERSION = null;
+// TCP port to listen on; can be overridden with flags.
+var port = 5000;
+
// If set to 1, we are already processing a JSON update and should not
// start a new one. If set to 2, we are _also_ having one in the queue.
var json_lock = 0;
'Content-Type': 'text/json',
'X-RGLM': this_json.last_modified,
'X-RGNV': num_viewers,
- 'Access-Control-Expose-Headers': 'X-RGLM, X-RGNV',
+ 'Access-Control-Expose-Headers': 'X-RGLM, X-RGNV, X-RGMV',
'Vary': 'Accept-Encoding',
};
var ims = (u.query)['ims'];
var unique = (u.query)['unique'];
- console.log((new Date).getTime()*1e-3 + " " + request.url);
+ console.log(((new Date).getTime()*1e-3).toFixed(3) + " " + request.url);
if (u.pathname === '/override-num-viewers') {
handle_viewer_override(request, u, response);
return;
}
});
});
-server.listen(5000);
+
+if (process.argv.length >= 3) {
+ port = parseInt(process.argv[2]);
+}
+server.listen(port);