# XMLSocket

**URL:** <https://forum.kirupa.com/t/xmlsocket/205642>\
**Category:** Uncategorized\
**Created:** [October 31, 2006, 4:08pm UTC](https://forum.kirupa.com/t/xmlsocket/205642 "2006-10-31T16:08:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lordkiller](https://avatars.discourse-cdn.com/v4/letter/l/9fc29f/32.png) [@lordkiller](https://forum.kirupa.com/u/lordkiller)\
**Post date:** [October 31, 2006, 4:08pm UTC](https://forum.kirupa.com/t/xmlsocket/205642/1 "2006-10-31T16:08:56Z")

</div>

Task: real time multiplayer game + chat…the server is ready with chatrooms, the messages show up nice so is working.  
The game itself need 4-5 arrays to pass from one player to other, in xml format, becouse this way I can handle them in the most efficient way.  
To separate the arrays from the simple chat text I tyred to filter the messages on the firstChild.nodeName, if is recognized than is a real xml , otherwise is chat text, but the XMLSocket.onData or XMLSocket.onXML functions I cant convince to recognize the incoming string as xml, when I redirect to an output textfield is looking ok the string so the xml formating isn’t a problem.

So my questions are:  
-how can use XMLSocket.onData or XMLSocket.onXML to assign the incoming message to an xmlObject , something in this manner(but this isnt working):

```auto
XMLSocket.onData = function(msg){
   myXML = new XML()
   myXML = msg // or whatever code need here
}

```

I cant find an evoluated tutorial on this question(all of them are only for a simple chat, no one is using more than a redirect to a textfield), so if somebody know one or have some code snippets… help pls
