views:

155

answers:

2

Are there any free Comet JavaScript libraries that allow multiple windows/tabs to reuse the same connection? In other words, when you open a second window, it detects that you have another window open under the same domain. Rather than open a new connection, it starts listening to the other window's connection. That way it can stay within the browser's per-domain connection limit.

Lightstreamer seems to handle this well, but I'd prefer something open-source.

A: 

I think the closest thing you're going to find in the Open Source world is going to be the functionality build into Dojo.

I'm sure in the future, you'll see more Open Source support for that kind of functionality...but for now you might have to hack something together.

Justin Niessner
A: 

You can't do that directly, because different browser windows/tabs don't know what connections are open in other browsers/tabs. The best you can do is either 1) wildcard a bunch of subdomains (the per-domain limit is per-subdomain too) or 2) use a cookie or some other form of persistent storage and fall back to short-polling, which is what the dojo framework does.

jvenema