I'm trying to pass a javascript object with socket.io. Client side
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
So this is suppose to send the cPlane object to the server.
Server side code is here
var sPlanes = {}; //stands for server Planes
socket.on("send planes", function(planes){
sPlanes = planes;
console.log(planes); //Is where I noticed the problem
});
when I do console.log(cPlanes) in the client side, I get this

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.

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.
//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);
}
});
this is what i get.

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