Published on October 20, 2008
AMFPHP Tiny-Mini-Little introduction Călin Iepure, X3 Studios http://calin-iepure.blogspot.com
What is AMF? • Action Message Format (AMF) • Is a binary format based loosely on the Simple Object Access Protocol (SOAP). It is used primarily to exchange data between an Adobe Flash application and a database, using a RPC • Was introduced with Flash Player 6, and was unchanged until the release of Flash Player 9 and ActionScript 3.0, when new data types and language features prompted an update
And what is it? • AMF is what Flex and Flash Remoting use to talk to the back-end server (Java, ColdFusion, PHP, etc.). • It provides serialization of Action Script Objects native types and objects to be sent to the server where they are unserialized into the server languages data type. • The serialization process is 100% binary in its transmission over port 80/443 • As of AMF3 the data is also compressed for faster transmission.
Then, what suppose to be AMFPHP? • The AMFPHP project aims to provide an open source alternative for Flash Remoting • The end result should be as capable of providing remote web services to a client as are the Macromedia commercial Flash Remoting packages. • AMFPHP are trying to keep the usage of the gateway as close as possible to the ColdFusion version to give Flash developers the freedom to change server technologies with minimum impact on ActionScript code.
How it works behind the scenes? • The server and the client, say PHP and Flash, agree on a common way of describing method calls and complex data. • The client serializes a request and sends it to a gateway. • AMFPHP then automatically: Deserializes the request Finds the corresponding remote class Instantiates the class Performs security checks Calls the remote method using the specified arguments Serializes the returned data
How it works behind the scenes? • AMFPHP can properly serialize and deserialize complex types. • In addition to objects and arrays, it supports resources from database connections, which means you can simply return mysql_query from your remote method and AMFPHP will know what to do with it • If the platform supports it (currently, Flash Remoting only), it can handle circular references and typed objects. • It also supports simple remote debugging. Finally, AMFPHP comes with a service browser which allows you to test your services before creating a frontend.
Remoting at the speed of GZIP… • Actual version comes with nice speed boost in the form of decreased transfer times over the wire, thanks to gzip encoding. • Basically, if a browser sends an Accept:gzip header to the server (ie, all modern browsers since IE5), AMFPHP will detect it and send the content gzipped. • For large amounts of data, this can result in much decreased network traffic; typical compression ratios can vary from 2:1 to 10:1, depending on data set • The nice part is that, once again, you don't need to configure anything to get this to work!
NetConnection in Flash Player • Flash Player 9 has native support for NetConnection in the Flash.net package which provides everything necessary for AMF communication. • This means that there is no longer a need to download and install Flash remoting classes or components • It also means that every Flash Player now has the encoding and decoding nativly supported and does not require additional code to be downloaded
What about Flex? • Flex 2 and Flex 3 has a package built on top of Flash.net.NetConnection called RemoteObject • RemoteObject gives you several helper functions that make development of large AMF applications much easier than using the native NetCOnnection • RemoteObject has a concurrency property that makes larger applications much easier to build. • It also has a ShowBusy cursor that you can use if the UI is useless unless it has updated data from the server
Demos ??? • Installation in 4 minutes • Making sure it works • Background info • Creating a remoting compatible service • Testing in the service browser • Security concerns • Understanding SQL injection • Preventing SQL injection • Etc…
Demos ? www.amfphp.org/videotuts.html
Links • http://www.amfphp.org/ • http://www.amfphp.org/docs/index.html • http://sourceforge.net/project/showfiles.php?gr oup_id=72483#files • http://www.amfphp.org/showcase.html
Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...
In this presentation we will describe our experience developing with a highly dyna...
Presentation to the LITA Forum 7th November 2014 Albuquerque, NM
Un recorrido por los cambios que nos generará el wearabletech en el futuro
Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...