XMLStreams class
227
See also
XMLSocket.connect()
XMLStreams class
Availability
Flash Media Server 2.
Description
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
“Constructor for the XMLSocket class” on page 219
.
The Flash Media 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
event 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.
Example
If you want your FMS 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
event is called as complete sections of XML occur in the
stream.
myXMLStreams = new XMLSocket("stream");
NO
TE
As a security precaution, if 4 KB of data arrives before a closing XML tag, the incoming
data is thrown away. This should not be a common concern—at least one complete XML
tag should arrive within 4 KB.