I have been experimenting with Node.js and Websockets lately. Making progress, but I encountered an unusual issue with JSON.stringify (client side).
I use JSON.stringify to see which object properties the server is returning.
For instance, this is the code snippet I have:
ws.onmessage = function(param1) {
alert(JSON.stringify(param1));
}
An alert box showing {"isTrusted" : true}
pops up.
Seeing this output made me think that the server did not send a message back to the client. To check, I modified the alert function to simply show
alert(param1.data);
The expected message appeared! So, my question is why didn't JSON.stringify display the data
object even though it was clearly there?