title: Socket IO emitting multiple times (equal to number of clients connected) using sails js
body: <p>I am trying to develop a simple socket io based chat app using sails MVC.
  whenever a client connected socket emitting multiple times(equa to number of clients).
  here is my code.</p>
  
  <p>Server :</p>
  
  <pre><code>io=req.socket.manager;
  var users=[];
  
  io.sockets.on('connection', function(client) {
      console.log("connected");
  
      users.push(client.id);
      client.on("chat", function(data) {
          io.sockets.sockets[data.to].emit("chat", { from: client.id, to: data.to, msg: data.msg });
          client.emit("chat", { from: client.id, to: data.to, msg: data.msg });
      });
  });
  </code></pre>
  
  <p>Client : </p>
  
  <pre><code>var socket=new io.connect('http://localhost:1337/');
  socket.request('/Chat/index');
  socket.emit('connection',function(data){
      console.log(data);
  });
  socket.on('connect', function() {
      console.log("Connected.");
      //
  });
  socket.on('chat', function(data) {
      console.log(data.msg );
  });
  </code></pre>
  
  <p>please help me , is there any way to get actual socket object in sails?
  I am using io=req.socket.manager; which is of req object.</p>