I am using socket.io version 0.8.4
I have welded my problem as follows. I have data looking like this:
data.prop1 = []; data.prop1.push("man"); data.prop2 = []; data.prop2["hey"] = "man";
I send data from the server to the client as follows:
socket.emit("data", data);
On the client side, I get the data as follows:
socket.on("data", function(data){ console.log(data); });
Weird:
data.prop1 = []; data.prop1.push("man"); // This data exists in the client side data object data.prop2 = []; data.prop2["hey"] = "man"; // This data does not exist.
data.prop2 is just an empty array on the client side.
Is there a known bug in json serializing arrays of a form in prop2?
Thank you in advance
EDIT:
The issue is resolved using this workaround:
data.prop1 = []; data.prop1.push("man"); data.prop2 = {}; // <= Object instead of array data.prop2["hey"] = "man";
source share