App level heartbeat to ensure clients get disposed() when they disappear
[KiwiIRC.git] / server / weblistener.js
index 475f017257b1e1052a74dbc2e6f9ecb9b2e80937..0a61821585829a21eeff35c9eefc73863eac893a 100644 (file)
@@ -85,7 +85,14 @@ var WebListener = module.exports = function (web_config) {
     });
 
     hs.on('request', function(req, res){
-        var transport_url = (global.config.http_base_path || '') + '/transport';
+        var base_path = (global.config.http_base_path || ''),
+            transport_url;
+
+        // Trim off any trailing slashes
+        if (base_path.substr(base_path.length - 1) === '/') {
+            base_path = base_path.substr(0, base_path.length - 1);
+        }
+        transport_url = base_path + '/transport';
 
         Stats.incr('http.request');
 
@@ -115,7 +122,7 @@ var WebListener = module.exports = function (web_config) {
                 return;
             }
 
-            client = new Client(socket);
+            client = new Client(socket, {server_config: web_config});
             client.on('dispose', function () {
                 that.emit('client_dispose', this);
             });