I have two software to create with AIR: a server and a client. Both with AS3 and AIR.
I want to avoid having a big architecture with Remote Shared Object, or using BlazeDS, or having to set a Java / Python / … server in the middle.
In order to avoid having to parse socket data in the server and in the client side, I thought about using XMLSocket on the client side: the data arrives in a way which is already parsed by the Flash framework.
However, when I use this XMLSocket with the AIR ServerSocket, the “connect” event returns me a raw Socket on the server side. So I have to manually manage the XML data on the server side.
Is there a way to also use an XMLSocket on the server side to communicate with the client? A kind of trick to convert the returned Socket into an XMLSocket?
If there is an AS3 library which manages that, I did not find it.
Thank you!
I totally agree with Adrian in that server side code in ActionScript is going to be bad, Java being syntactically not that far would be much much better: hotspot JIT, multithreaded, with lots of highly optimized server side components.
Now having said that: XML Socket presents you with a parsed XML, still what is going to be transmitted over the wire will be just XML as text. So performance-wise it is just the same as using a regular socket and parsing yourself. And this can be as easy as:
So once you’ve received a full xml payload you’re ready to go.
And if you think XMLSocket can take care of getting a full XML before parsing, I did some XML Socket stuff and got XML delivered in two or more fragments and had to cope with it myself, her an example: