If you are familiar with Flash, you may know the AMF protocol. The use of this protocol is more in some fields such as data processing. However, this protocol is still based on the Http protocol. Now let's take a brief look at the specific situation of AMF.
Http-based AMF Protocol
The content processing process is roughly as follows:
1. Obtain the Http Request stream from the client.
2. Stream deserialization (Deserialize) to obtain data that can be recognized by the server program and establish a Response Message
3. Start Debug
4. stream processing (record, license, service) to get the return value
5. serialize the response stream
6. Send an Http Response to the client
The values of the Flash ActionScript data type in the AMF Protocol are:
- Number 0x00;
- Boolean 0x01;
- String 0x02;
- Object 0x03;
- MovieClip 0x04;
- Null 0x05;
- Undefined 0x06;
- Reference 0x07;
- ECMAArray 0x08;
- ObjectEnd 0x09;
- StrictArray 0x0a;
- Date 0x0b;
- LongString 0x0c;
- Unsupported 0x0d;
- Recordset 0x0e;
- XMLObject 0x0f;
- TypedObject(Class) 0x10;
AMF (Action Message Format) is a binary format data type. The flash data is encoded by AMF over HTTP and sent back to the server, after the remoting adaptor of the server receives the data, it decodes the correct native object and submits it to the correct program for processing 。
In addition to Flash remoting, AMF is also widely used for Local Connection and Flash communication server. Its biggest feature is that it can directly convert flash native objects, such as object, Array, Date, XML, return to the server and automatically translate it into appropriate objects on the server. For example, when flash Array is returned to PHP, it is automatically converted to Associative Array; the biggest benefit of this feature for developers is that they do not need to manually process the complicated work of serialization and deserialization, which not only improves accuracy, but also saves time for development 。
Because the AMF protocol is binary format and is highly compressed during encoding, It is very suitable for transmitting a large amount of data. According to the flashorb website testing (mainly for web service and flash remoting ), the higher the data volume, the higher the transmission efficiency of flash remoting, which far exceeds the performance of web services. Therefore, we can also learn the xml, loadVars, loadVariables and other transmission methods using plaine text format are naturally incomparable 。