Object | +-XMLSocket public class XMLSocket extends Object
The XMLSocket class implements client sockets that let the device running the Flash Lite player communicate with a server computer that an IP address or domain name identifies. The XMLSocket class is useful for client-server applications that require low latency, such as real-time chat systems. A traditional HTTP-based chat system frequently polls the server and downloads new messages by using an HTTP request. In contrast, an XMLSocket chat solution maintains an open connection to the server, which lets the server immediately send incoming messages without a request from the client.
To use the XMLSocket class, the server computer must run a daemon process that understands the protocol that the XMLSocket class uses. The following list describes the protocol:
The following restrictions apply to how and where an XMLSocket object can connect to the server:
Setting up a server to communicate with the XMLSocket object can be challenging. If your application does not require real-time interactivity, use the loadVariables() function, or Flash HTTP-based XML server connectivity methods (XML.load(), XML.sendAndLoad(), XML.send()), instead of the XMLSocket class.
To use the methods of the XMLSocket class, you must first use the constructor, XMLSocket(), to create an XMLSocket object.
loadPolicyFile (security.loadPolicyFile method)
Properties inherited from class Object
|
constructor (Object.constructor property), __proto__ (Object.__proto__ property), prototype (Object.prototype property), __resolve (Object.__resolve property) |
|
Event |
Description |
|---|---|
|
onClose = function() {} |
Invoked only when the server closes an open connection. |
|
An asynchronous callback that the Flash Lite player invokes when a connection request initiated through XMLSocket.connect() succeeds or fails. |
|
|
Invoked when a message is downloaded from the server and terminated by a zero (0) byte. |
|
|
Invoked by the Flash Lite player when the specified XML object containing an XML document arrives over an open XMLSocket connection. |
|
Signature |
Description |
|---|---|
|
Creates a new XMLSocket object. |
|
Modifiers |
Signature |
Description |
|---|---|---|
|
|
close() : Void |
Closes the connection that the XMLSocket object specifies. |
|
|
Establishes a connection to the specified Internet host by using the specified TCP port and returns true or false, depending on whether a connection is successfully initiated. |
|
|
|
Converts the XML object or data specified in the object parameter to a string and transmits it to the server, followed by a zero (0) byte. |
Methods inherited from class Object