In my previous post, I talked about how to handle websockets in Adobe AIR. I’ve written a library around it, which makes it easier to implement in your projects. Another benefit of the library, is you can combine websockets with regular sockets, so you’re able to talk between Adobe AIR, websockets and flash sockets.
First of all, download the sources containing the library and some demo projects. Import the library project into Flash Builder. Next step could be checking out the demo’s: you’ll need the server demo (MessagesDemoServer), which is an Adobe AIR app.
This MessagesDemoServer example, listens for amf sockets on port 1234 and websockets on port 1235:
1 2 3 4 5 6 7 8 9 10
You’ll also notice the need to specify a “ClientHandler Factory”. This way, you can specify custom object serializers if needed and custom crossdomain xmls (optional). Right now, there’s support for JSON encoding (for text-socket communication like websockets) and native encoding (for communication with flash client sockets).
So, download & enjoy this library You can report bugs, or send in suggestions in the comments… Stay tuned for some more updates the next couple of days…