Remoteobject (AMFPHP)or HttpService? Which is the best to choose from?
Please explain me which of two is secure, powerful one, fast enough on sending to and receiv开发者_JAVA技巧ing requested data from the server in Flex!
I prefer working with remoting object with AMFPHP rather than HTTPService
Check out James Ward Census Application for information on performance and data transfer size.
For performance, use RemoteObject.
However, since you ask for "Fast enough" i really depends on your application and the amount of data.
Either channel is secure as the other. HTTPS would make it more secure. I don't think anything can prevent packet sniffers from getting at the data in transit.
AMF(Remote Objects) – Why its Better
- It’s a binary protocol .
- But its still encapsulated in HTTP so there is no concern with firewalls or client issues and we can use our normal web debugging methods.
- HTTP headers with a binary body.
HTTP/1.1 200 OK
Date: Tue, 28 Jun 2011 12:55:26 GMT
Content-Type: application/x-amf
Server: stackoverflow.com
(binaryamf body here)
- Because it is binary, it can use pointers.
- -Circular References
- -Objects only transmitted one time.
- Common Strings, for example, are only sent once, then all other references to that string only contains a pointer, instead of being re-transmitted.
- Same behavior for all Objects.
- Its Transmitted binary format (spec) is the same format as how the Flash player stores its objects into memory.
- -No de-marshaling (expensive)
- -No de-serializing
- -Bits from HTTP stream flow ~> into Flash Player Memory
- James Ward Census Data
- -A flex application that is built to use several different transport mechanisms while transferring the same data. Show comparative timings of each stage of data transfer.
- -James Ward Census
AMF is supposedly always going to be faster, but HttpService using XML or JSON is used probably more often. If its only a small project, or if its going to be using web based api's that may be used by other technologies, then maybe httpService is quicker to get implemented.
If you want to quickly try out AMF PHP using ZendAMF, I put up a tutorial and demo here:
http://bbishop.org/blog/?p=441
Includes all the php and config file details, as well as server setup.
Security has little to do with it because. AMF will save you bandwidth costs by using a binary protocol instead of a string one. It's an additional layer of obfuscation but there are some packet readers that will read AMF anyways. If you plan to have alternates to desktop client, say mobile, going AMF may lock you out because those other clients may not be Flash Player based. The advantage of going non-AMF is that you can open the possibility of other clients but the trade off is if the app is bandwidth intensive, HTTP requests with string bodies will weigh heavier than the AMF Binaries.
精彩评论