tags:

views:

190

answers:

2

Hi chaps,

I currently have a Java server that talks to a Flash client by passing JSON encoded data over a binary socket connection. Is there a way on either side to encode / decode packets as AMF instead of JSON? It seems to me that there should be some native support in Flash player for doing this? All the implementations I have found of AMF serialization seem to be embedded inside an application framework.

Simiarly so, does anyone know if it's possible to decode AMF packets independently of a connection implementation in Flash?

A: 

AMF stands for Actionscript Messaging Format and is supported by the flash player itself out of the box. For the Java side, I'm sure there's some library already written. Red 5 is an open Flash Server written in Java that supports AMF, so you could check it out.

PS:

Looks like AMF serialization / deserialization is dealt with in this package (red 5 code): http://red5.googlecode.com/svn/java/server/tags/0_9rc1/src/org/red5/io/amf/. Not sure if there's a nice standalone API for this, though.

Juan Pablo Califano
We migrated away from Red5 due to performance issues. It suffers very badly with large numbers of concurrent users.
Ceilingfish
I meant that since Red 5 is open source, you could check how it handles AMF (and maybe it's using some open source lib for this). Re your comment about performance, I've heard good things about Wowza (http://www.wowzamedia.com/) I don't have direct experience with it, though.
Juan Pablo Califano
+2  A: 

You can use OpenAMF's AMFDeserializer class,

http://www.openamf.com/javadocs/org/openamf/io/AMFDeserializer.html

You can also use the relevant classes in RED5 and BlazeDS.

ZZ Coder
That looks pretty cool, seems to stick more to the conventions of java.io.
Ceilingfish