Archive for the ‘AJAX’ Category

New Cometd client and server demo

Friday, November 7th, 2008

On and off for the last couple weeks I have really been pushing myself to learn Java better. I constantly find myself unable to do things I want to with the languages I usually use (PHP specifically). As I am getting better I am coming to like it a lot more. As any reader of my blog (do I actually have ‘readers’?) know, I am really into Cometd, which the most major implementation of is written in Java. So in order to utilize Cometd Java and push my jQuery plugin further along, I figured it was high time I learn Java. I am really glad I am too. Just in time for my new Android phone too :)

CometdMap
Almost every demo of Cometd out there is a chat application, next up is stock tickers. There are one or two more I can think of off hand, none of which could be made into something more useful. I have had an application idea in the back of my head for quick some time. I really like doing work with maps, have been doing professional Google Maps work for a couple years, had to get the (second) dorkiest bike computer with GPS to map my rides. I have wanted for some time to do a real-time map. CometdMap is a proof of concept of that. It has no actually data input at the moment, infact, it is really basic right now. What it really does is show how simply you can build a Cometd Java app. I was really surprised at how easily I built this with my limited knowledge of Java.

What does it do
Right now, if you build and run the application you will get a simple Google Map. Clicking on the map will place a marker. Wowee! Pretty basic yeah, but what is going on here. Clicking the map publishes the point to the server, it is not until the server returns the data to the subscription callback that it is added. That is about all for the client side. On the server side two things are going on. First, when a new client joins they are added to a list, very similar to the way the Cometd Chat demo handles clients for private messages. Second, when points are published they are tracked on another list. So what can we do with these lists? Add a couple points and reload your browser. Since you are now a new client and there are points on the list, the old points are sent back to you. This will work for any new clients joining also. With multiple clients connected markers are updated to each in real-time.

Download & Build
Download
As I have mentioned before, the Java build environment and I do not exactly get along. In the tarball there is a script call build (partially ripped from the Harmony build script). If you have built the Cometd demo from Jetty with Maven this script should work just fine. Otherwise change the paths in the build (and server) scripts to point to the directories where your Jetty and Comet components are.

Enjoy, hopefully everyone is able to build with few problems. Check back in a couple weeks to see what I have in store next. Cheers, Morgan.

jQuery Comet update (finally).

Tuesday, September 9th, 2008

Now that I am semi-settled in here in Berlin (anyone have a room for rent? (cheap)), I am trying to get caught up on stuff. I finally pushed some fixes suggested by Jörn and got the chat demo reported. Its all in the SVN at Google Code and setup an external item in the jQuery SVN. Also sent an email to Greg Wilkins today, hopefully I can get this into the Cometd SVN also.
Next release will be a total rewrite, I made a lot of mistakes in the original, and the prefer jQuery plugin style has changed. Getting back to this point will not be too difficult, and well worth it.

DBXMLAdmin updates

Thursday, May 29th, 2008

After being completely annoyed by SimpleXML earlier I decided it was time to look at DBXML again. This time I ran across a forum posting saying that DBXML 2.4.11 had a bug in it preventing updating. After upgrading to 2.4.13 I was able to update documents in a container. So I made some update to the project but realized that this was more of an out of control experiment than a real project. Already started redoing it, all the PHP is going to be new but I have managed to reuse most of the Javascript.

I also found this site DBXML With PHP, it is a small wiki for, as the name says, using DBXML with PHP. It has not been updated in a while (until today) but I will keep adding things as I progress on DBXML. Hopefully other will help out too, right now there are few resources for DBXML in PHP.

jQuery Comet in the wild

Monday, February 4th, 2008

I am really exited about recent talks I have had with the Erlycomet team, and now they are including an early version of the jQuery cometd plugin as one of their demo options! I am working now to include some code they contributed in the main distribution. I also setup a Google Code project with the latest SVN. I am really exited about all of this, and hope to see more interest and contributions to the project.

Callback polling

Monday, January 21st, 2008

I spent this last weekend in Carson CA watching the UCI Worldcup of Track Racing. Pretty amazing sight. But between races I managed to implement callback-polling in the Comet jQuery plugin. Now cross domain calls are supported. As usual you can get the code here.

Phomet: A PHP Cometd publisher

Friday, January 11th, 2008

Created a small class last night that will allow you to connect, and then publish to a comet server. Code available here. Usage is simple.

$oPhomet = new Bayeux(‘http://whereis/my/cometd’);

$oPhomet->publish(‘/some/channel’, array(‘user’ => ‘derper’, ‘message’ => ‘wee’));

The deconstructor takes care of disconnected you from the server, but if you wish, you can use ->diconnect() before.