engine.io fix for "forgetting" remoteAddress on websockets
authorDarren <darren@darrenwhitlen.com>
Wed, 4 Jun 2014 14:49:37 +0000 (15:49 +0100)
committerDarren <darren@darrenwhitlen.com>
Wed, 4 Jun 2014 14:49:37 +0000 (15:49 +0100)
server/weblistener.js

index 02bdca32d7a9829719afb82f3acdd9bd4a2622b4..fcaeb7cca4a112ca9a2f1417cd9f0d12b8e537b0 100644 (file)
@@ -75,6 +75,11 @@ var WebListener = module.exports = function (web_config) {
     this.ws = new engine.Server();
 
     hs.on('upgrade', function(req, socket, head){
+        // engine.io can sometimes "loose" the clients remote address. Keep note of it
+        req.meta = {
+            remote_address: req.connection.remoteAddress
+        };
+
         that.ws.handleUpgrade(req, socket, head);
     });