Wednesday, July 26th, 2006

Cross Domain Comet

Category: Comet

Adding on to the last post on cross domain XHR, Cometd now supports working across domains, without plugins.

Alex Russell explains:

By building on top of the Dojo ScriptSrcIO infrastructure it was trivial to make a JSONP transport for Cometd. We just adapt the long-poll style of Comet but make the initial handshake messages JSONP-clued. That in place, the rest works just like “normal” long-polling, except that the client can connect from any domain. The configuration problem just dropped from “make sure everything cooperates at the systems and network level” to “make sure that the client and server speak the same protocol”…and I like solutions that put the problem in software and not external configuration or human effort.

So what’s the downside? The first downside is that the latency characteristics for cross-domain Comet using this technique are the same as long-polling. Not bad, mind you, but not as optimal as iframe, multipart-mime, or Flash-based solutions when you have large numbers of messages being thrown at the client. Additionally, it’s more difficult to know when a connection “times out” or in some other way fails, but I think these are tractable. Having a Plan A and a Plan B for cross-domain Comet and a server that can speak both styles via pluggable transport wrappers is exciting to me. By lowering the configuration barrier, I think we’ll start to see a significant uptick in Comet adoption.

Posted by Dion Almaer at 9:42 am
1 Comment

3.9 rating from 31 votes

1 Comment »

Comments feed TrackBack URI


Comment by 02qd0 — August 17, 2006

Leave a comment

You must be logged in to post a comment.