Hi I have this code when I send message:
var msg = {
name: userName,
text: ABCD
};
var json = JSON.stringify({ type:'message', data: msg });
socket.send(json);
And here the code that receives the message:
socket.addEventListener("message", function(event) {
console.log (event.data);
});
Here's what it displays:
{"type":"message","data":{"name":"userName","text":"ABCD"}}
How do I make it display like this:
userName
ABCD
Thanks
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en