Thursday, February 21, 2008

Push without Flex Data Services

We all know that flex data services is good but is it really neccesary to implement push on flex page?? As a developer with very little money to spend on tools, I was looking out for alternatives.

And Alternative I did find!! The magic is called "XMLSocket"

Though the xmlsocket implementation is depicted as a way for the client and server to talk with xml , there is nothing potentially stopping us from sending just plain text ...

So this is how I did it..

1. Create a java based service that runs on a port (5976 in my case) that spits out content on the port when ever it is available. (This can easily be replaced by a JMS). This includes setting up a thread to write to the socket whenever data is available.

2.Open a xml socket to the server from the flash client.

3. create an ondata handler in the flex part that updates your interface .

There you have it.. :-)

I will be posting the code sample and explanation shortly .. watch out.

Happy flexing.