Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Presentation: Interactive Websites with Comet and DWR

Presentation: Interactive Websites with Comet and DWR


In this session filmed during QCon London 2008, Joe Walker presents Comet, a long polling AJAX method used for updating the browser’s page, and DWR, a Java library for writing web sites using AJAX.

Watch: Interactive Websites with Comet and DWR (1 hour)

Comet opens a network connection and keeps it open indefinitely to allow the server to respond when it needs to. The server seems to be pushing data to the browser, but in fact it’s a long polled connection. This approach allows web servers to update pages when new information is available, and avoids the process of creating a new connection every time the browser wants to. Comet changes the HTTP request-response communication model into a server push one being useful for interactive pages. There are major web sites and applications using Comet: GMail, GDocs, Meebo, Yahoo! Mail, Jot and others.

Walker presents the benefits of using Comet and the difficulties they encountered in creating it. He also talks about DWR using code snippets. DWR allows “web browsers to securely call into Java code almost as if it was running locally.” DWR can also “marshal virtually any data including collections, POJOs, XML and binary data like images and PDF files.”

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Excellent!

    by Siva Prasanna Kumar,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Excellent talk, but what about the number of open connections on the servers? Isn't their a limitation on that? Hmmm long back I had written a article about Server Push using Blaze DS, in that article we had to explicitly specify the user-agent based settings as shown below:

    <user-agent match-on="MSIE" kickstart-bytes="2048" max-streaming-connections-per-session="3"/>
    <user-agent match-on="Firefox" kickstart-bytes="2048" max-streaming-connections-per-session="3"/>

    Do we need to do something similar in DWR also? My previous experience was with DWR 1.0, it was great but had some browser specific behaviors (had some issues with Mozilla, use to work great on IE). Never got a chance to look in to DWR 2.x, I think I will directly try DWR 3.0, when is it expected to release?


    Siva Prasanna.

  • I've another idea

    by Hazem Salem,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    I used to implement comet using WCF (Dublex) over HTTP in real time applicaiton
    We face a lot of challenges in implmenting it but we succefully overcome them all and the idea is running perfectly now.
    we succfuly overcome the problem of this max-streaming-connections-per-session="3"
    Now no limits in using comet

    I'm preparing to post our idea soon


  • Comet on the rise?

    by Jurgen Huls,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    I think general Comet use is on the rise again. Its the new Ajax, lots of people seem to be using it now. We're starting to implement Comet features in to our social networking site using StreamHub Comet server. Like DWR, we can use our existing Java skillset so it suited us. It will be interesting to see how Comet grows in the future.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p