Copy link to clipboard
Copied
Hi, I need some clarification about what's happening behind the scenes with the XmlSocket on AMS. The documentation is inconsistent with the behavior I'm seeing. Specifically the documentation states:
XmlSocket.onData(src)
Invoked when a message has been downloaded from the server, terminated by a zero (0) byte. You can override XMLSocket.onData() to intercept the data sent by the server without parsing it as XML. This is useful if you’re transmitting arbitrarily formatted data packets and you would prefer to manipulate the data directly when it arrives, rather than have Flash Media Interactive Server parse the data as XML.
If I send a string across the connection like "Hello there!", my onData handler never gets called. I did make sure the stream was terminated with a zero byte. I also just tried sending a message with 0 length buffer and, new lines and carriage return values as well to the ends of my strings all to no avail.
However, when I send a message like "<a>Hello there!</a>", my onData handler does get called. This leads me to believe that there is actually processing for the XML happening before onData is handled. The reason I'm asking, is that we are suffering seg faults while processing XML data, and are trying to get a lock on where/why.
I'm using AMS - 5.0.3 r3029 x64
AS3 Documentation
Adobe ActionScript 3.0 * Socket connections
FMS - XmlSocket Documentation
Copy link to clipboard
Copied
Hi,
Are you creating a "flash" type or "stream" type XML socket?
Copy link to clipboard
Copied
I'm creating a 'stream' type XML Socket.
Copy link to clipboard
Copied
Going to keep bumping until I hear something.... Adobe's help on these forums is pretty sad...
Copy link to clipboard
Copied
Hi,
Sorry for late reply.
There are two types of XML socket - flash type and stream type. For both the cases, if the user defines onData handler, then the user handler gets called. For flash type XML Sockets, you can pass any data and can have any processing on data according to the handler. However for stream type XML Sockets or XMLStreams you need to pass a valid XML data because it checks for opening and closing tags before calling the user defined handler. So, either you create a flash type socket and define onData handler accordingly or pass a valid XML to stream type XML socket.
Hope this clarifies your query. Again very sorry for the inconvenience caused.