I put together a little demo of getting an event driven/server push application running on Minimo. In the video clip below you'll see that I have my PDA resting on my laptop and on my laptop I have firefox open with a local PHP page. The PHP page has a couple checkboxes that when clicked and the submit button pressed will actually open up a socket connection to the IP address I specified in the text field above. The script then sends a JSON encoded event string of data. That string gets read in by a custom minimo/firefox extension I wrote that listens on a particular port for incoming connections, reads in any data sent then forwards that on to user land javascript. By user land javascript I mean javascript written on a regular webpage, not in the extension itself.


What you see happening in that video is me clicking a checkbox on my webpage on my local laptop. When I click the submit button PHP will attempt to open up a socket connection on a particular port for that IP, then try and send a JSON encoded string of data. The server in this case is a custom firefox extension that will accept this socket request, gather up the data and then forward that to my webpage where I have code that takes the event and loops through all the registered observers and executes a function when that event occurs. So my web page basically says "hey you, send me a message when the event "go" comes in and here is the function I want you to execute when that event comes in.

The best part is the same code works on firefox as well as minimo. Now obviously this is a firefox only implementation of "comet" or event driven applications however in my case that is fine because I get to define the browser my clients will be using for our application. Perhaps some of you are in the same boat. The key thing to remember about this application is it's completely event driven, no polling hacks, no AJAX tricks, no keeping a connection open. Low resources baby. No ajax was used in the making of this app however I did use the My-Bic [url]http://www.litfuel.net/mybic[/url] ajax library to provide the JSON encoding/decoding I needed for my particular application.

In my particular application picture you're on a plane and someone wants to order a drink so they hit the service button on their seat. That button sends a message that is broadcast out to the rest of the system and if the crew member assigned to your section is signed in on their IPAQ they should get a little alert on their device, all asyncronously.

Ready for More?

Follow Me @jimplush