title: Socket.io passing javascript object
body: <p>I'm trying to pass a javascript object with socket.io. 
  Client side</p>
  
  <pre><code>var cPlanes = {}; //stands for client Planes
  var plane = new Plane(x, y, z, model, name); //A plane object I made filled with stuff
  cPlanes[nickname] = plane; //Nickname is defined elsewhere
  socket.emit("send planes", cPlanes);//socket is defined elsewhere too
  </code></pre>
  
  <p>So this is suppose to send the cPlane object to the server.</p>
  
  <p>Server side code is here</p>
  
  <pre><code>var sPlanes = {}; //stands for server Planes
  socket.on("send planes", function(planes){
      sPlanes = planes;
      console.log(planes); //Is where I noticed the problem
  });
  </code></pre>
  
  <p>when I do <code>console.log(cPlanes)</code> in the client side, I get this</p>
  
  <p><img src="https://i.stack.imgur.com/Soz4E.png" alt="enter image description here"></p>
  
  <p>It's three.js for people who are wondering. This is the correct output, notice how the type of the object is Plane
  But when I print out sPlanes from the server, which is suppose to equal cPlanes, I get this. </p>
  
  <p><img src="https://i.stack.imgur.com/EEOGR.png" alt="enter image description here"></p>
  
  <p>It may look correct, but it's missing tons of properties. Then I decided to try and send it back to the client side and see what I will get.</p>
  
  <pre><code>//Server side
  io.sockets["in"](socket.room).emit("draw planes", sPlanes);
  
  //Client side
  socket.on("draw planes", function(planes){
      cPlanes = planes;
      for(var i in cPlanes){
          console.log(cPlanes);
      }
  });
  </code></pre>
  
  <p>this is what i get.</p>
  
  <p><img src="https://i.stack.imgur.com/XkxzQ.png" alt="enter image description here"></p>
  
  <p>Notice the difference between the first picture and the third. I think socket.io is converting my Object to something else. But I could be making a stupid mistake somewhere in there. I'm new with socket.io and node.js, so any help will be appreciated. Thanks :D</p>