title: How to get ip in socket io
body: <pre><code>var app = require("express")();
  var server = require("http").Server(app);
  var io = require("socket.io")(server);
  var requestIp = require('request-ip');
  server.listen(3000);
  
  var ipMiddleware = function(req, res) {
      return requestIp.getClientIp(req);
  };
  
  var ip = null;
  app.get("/", function (req, res) {
     ip = ipMiddleware(req, res);
     res.sendFile(__dirname + "/index.html");
  });
  
  io.on("connection", function (socket) {
     // send the ip to user
  });
  </code></pre>
  
  <p>My problem is, I would like to get ip address of client with express and emit the ip address to client, ips are the different ones then it should be, how can I emit the ip I get with express ? thank you</p>