The XMLStreams class is a variation of the XMLSocket class—it
has all the same methods, properties, and events, but it transmits
and receives data in fragments. To create an XMLStreams object,
use the XMLSocket constructor and pass "stream" as
the parameter. See XMLSocket constructor.
Flash Media Interactive Server can transmit XML data in stream
format (for example, as needed by a Jabber server or
IM applications). Streaming XML data passes over a normal XMLSocket
connection, but it begins with a stream:stream tag,
contains fragments of XML content, and concludes with a /stream:stream closing
tag.
The onData() handler is invoked and returns
complete XML tags whenever it receives them. The /stream:stream tag
closes the stream. There is an asynchronous call to onData() whenever
a complete tag has been received by the stream.
Note: As a security precaution, if 4096 bytes of data
arrive before a closing XML tag, the socket connection closes. You
can configure this value in the XMLSocket.maxUnprocessedChars property
or in the MaxUnprocessedChars element in
the Application.xml file.
Availability
Flash
Media Server 2
Example
If
you want your Flash Media Server application to communicate with
a Jabber server, which uses XML streaming, create an XMLStreams
object. The XMLStreams object connects to a remote XML streaming
server, and the onData() handler is called as complete
sections of XML occur in the stream.
myXMLStreams = new XMLSocket("stream");