Action Message Format (AMF) is a binary format used to serialize object graphs such as ActionScript objects and XML, or send messages between an Adobe Flash client and a remote service, usually a Flash Media Server or third party alternatives. The Actionscript 3 language provides classes for encoding and decoding from the AMF format. The format is often used in conjunction with Adobe's RTMP to establish connections and control commands for the delivery of streaming media. In this case, the AMF data is encapsulated in a chunk which has a header which defines things such as the message length and type (whether it is a "ping", "command" or media data).
CocoaAMF is a set of classes which can make AMF0 and AMF3 remote calls or act as a server to handle AMF requests.
For sending a remote call see SimpleRemotingCallExample. For setting up a server see ServerExample.
For testing an existing AMF server a more complex tool is provided, namely AMFClient, so be sure to check it out!
If you want to send custom classes from Cocoa make sure to implement the NSCoding protocol. You can encode keyed and non-keyed objects, where the latter means you're encoding an externalizable class.
While deserializing, if no class with the classname of the received object is found, CocoaAMF creates an instance of ASObject which will contain all attributes of that object and its classname as the ivar 'type'.
- Deusty Designs for CocoaAsyncSocket (https://github.com/robbiehanson/CocoaAsyncSocket)
- Binary God for BGHUDAppKit (http://code.google.com/p/bghudappkit/)
- Jonathan Wight for TouchJSON (http://code.google.com/p/touchcode/)
- The PyAMF Team for PyAMF (http://pyamf.org/) and therefor letting me have a reference and unit tests which I can steal shamelessly