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.