title: Socket IO Client receiving object DIFFERENT from what Server sent
body: <p>I am sending an object from my server side to my client side, and the object that the client gets is totally different than the object I send. Here's what I mean:</p>
  
  <hr>
  
  <h1>Code</h1>
  
  <p><strong>Server side code:</strong></p>
  
  <pre><code>//Basic setup for the example
  var res={};
  res.models=[];
  res.models[0]={};
  
  //The OLD (wrong) value
  res.models[0]['id']="b4fd12f1-61ca-4445-b916-62617f1c0a78";
  
  //The NEW (correct) value
  res.models[0]['id']="fb8f83e2-e157-4e1e-8315-8e5f03b44691";
  
  //Output what the id is, this is always the correct id!
  console.log("res.models[0]['id']: ",res.models[0]['id']);
  socket.emit("updateRealSeatSelect", res);
  </code></pre>
  
  <p><strong>Client side code:</strong></p>
  
  <pre><code>socket.on("updateRealSeatSelect", function(data){
      //Output the id when we get the object. This is always wrong!
      console.log("res.models[0]['id']: "+data.models[0]['id']);
  });
  </code></pre>
  
  <p>The output is the problem. Here's what I get:</p>
  
  <hr>
  
  <h1>Output</h1>
  
  <p><strong>Server Side Output:</strong> (Correct)</p>
  
  <pre><code>res.models[0]['id']:  fb8f83e2-e157-4e1e-8315-8e5f03b44691
  </code></pre>
  
  <p><strong>Client Side Output:</strong> (Wrong! Why is it different??)</p>
  
  <pre><code>res.models[0]['id']: b4fd12f1-61ca-4445-b916-62617f1c0a78
  </code></pre>
  
  <p>I have double triple quadruple checked that the <strong>server is sending the correct object</strong> with the correct id. <strong>When the client gets the object, the object is different</strong> and has the wrong id! How can this happen?</p>
  
  <hr>
  
  <h1>Misc</h1>
  
  <p><strong>Attempts:</strong></p>
  
  <ul>
  <li><p>I tried copying <code>res</code> into a new object, then sending that, but that also didn't work. Like this:</p>
  
  <pre><code>var newres = res;
  socket.emit("updateRealSeatSelect", newres);
  </code></pre></li>
  <li><p>I also tried using <code>JSON.parse</code> and <code>JSON.stringify</code> when I send the object but this didn't help either. Like this:</p>
  
  <pre><code>socket.emit("updateRealSeatSelect", JSON.stringify(res));
  </code></pre></li>
  </ul>
  
  <p><strong>Versions:</strong></p>
  
  <ul>
  <li>Express Version:  3.5.2</li>
  <li>Node Version: v6.5.0</li>
  <li>Socket.IO: v1.3.6</li>
  </ul>