Comet (with Dojo and Jetty)

Yesterday I started playing with the comet programming model, by using Jetty on the server and the Dojo Toolkit on the client. The application was quiet simple, but it did what I wanted to archive: “Updating the client, based on a server side event” (by faking a message/event driven architecture, by using a ServletFilter to queue a message to a single channel😉 ).

Today I tried to use multiple channels:

  • having the client subscribing to multiple channels
  • having the Filter queuing messages to different channels

It worked fine! Doing this one the client:

...
dojox.cometd.subscribe("/ping",callback);
dojox.cometd.subscribe("/pong",pongcallback);
...

I was able to subscribe to multiple channels. Now I had a second Filter; one queued a message to the “/ping” channel and the other to the “/pong” channel. After that, I created a third Filter to publish message on both channels.

Both things worked great! Now it would be interesting to create a web 2.0 / mashup application to “listen” to stock ticker (and/or weather) services and rapidly display the changed value (of the stock for instance).

I really enjoyed my simple comet programming steps. Next thing might be the integration of a message broker to have a more realistic application.

Howdy!

Posted in ajax, comet, dojo, java, jetty, web²
2 comments on “Comet (with Dojo and Jetty)
  1. VP says:

    Hi,

    Can you tell me which version of Dojo did you use? I had read somewhere that there is an issue with using Dojo 1.0 with Jetty server.

  2. matthiaswessendorf says:

    I used the one, provided by the jetty bundle (see here https://matthiaswessendorf.wordpress.com/2008/02/03/comet-using-jetty-and-dojo/)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: