Remote Data Communication in Flex June 1, 2010Posted by Tournas Dimitrios in Flex.
When building Flex applications , it is important to understand how to get data into and out-of your applications .Also your applications may need to support interoperable machine-to-machine interaction over the network (in technical jargon it is called “webServices”) Remote data communication occurs at runtime.It does not reside strictly in the client , but requires network connections to send and receive data between client and server. Flex applications support a variety of remote data communication techniques built on standards . There are three basic categories of Flex application remote data communication. I”ll try to shed some light on the 3 basic categories that are been used to accomplish the previous mentioned functionality .
This category consists of several overlapping techniques. Utilizing the Flex framework HTTPService component or the Flash Player API URLLoader class, you can send and load uncompressed data such as text blocks , URL encoded data , and XML packets , You can also send and receive SOAP packets using the Flex framework WebService component . And you can use a technology called Flash Remoting to send and receive AMF packets , which use a binary protocol that is like SOAP (but considerably smaller —->> 7 times), Each technique achieves the similar goal of sending and receiving responses using HTTP or HTTPS protocol .( for the techies this protocol is the layer 7 vs application layer of the OSI model )
- Real-time/Socket communication
This category consists of persistent socket connections . Flash Player supports two types of socket connections : those that requires a specific format for packets (XMLSocket) and those that allow raw socket connections (Socket). In both cases, the socket connection is persistent between the client and the server , allowing the server to push data to the client ( in technical jargon it is called messaging ) . In contrast the previous mentioned technique (HTTP request/response -style ) is based on the so-called three-way handshaking model that requires the client-server communications to be instantiated only from the client .
- File upload/download communications.
This category consists of the FileReference API which is native to Flash Player and allows file upload and download directly within Flex applications .Clearly this category applies only to cases where the application requires file uploading and downloading
The HTTP request/response is far more common than real-time data communication . Although real-time data communication is necessary for some low-latency applications , it adds network overhead to the application because it requires a persistent socket connection for each user . In contrast HTTP request/response communication is always instantiated by the client in the form of a request . The server returns a response to the client , and then the connection is closed again until the client makes another request ( remember the three-way handshaking model that was mentioned previously).
My opinion is that the request/response model is more efficient .