What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

I found out that SE is using "simple" polling, but I wonder how SE chat works when multiple tabs in the same browser context are opened. When I open two or more tabs with some chat rooms it looks like (through developer tools) only one tab keeps active polling (obviously checking http://chat.stackoverflow.com/events for changes) and the others are "silent" (although I can see sporadic errors regarding polling and sometimes actively polling tab "change" their polling duty with other silent tab).

  • do you somehow synchronize events between silent tabs and the active one which is polling for changes?
  • I'm wrong and you are hitting parallel connections limit?
  • I'm completely wrong and some other (non-secret) magic is involved?
share|improve this question

1 Answer 1

up vote 7 down vote accepted

You're absolutely correct; if your browser supports the HTML DOM storage (and all reasonably modern browsers do), we utilize it as a communication mechanism between several open tabs on the same chat site. The main purpose is indeed having only one window do the polling (saving network traffic for both your browser and our server).

share|improve this answer
    
That's interesting because for example Facebook is using unique (sub)domain for each long polling tab (to overcome parallel connections limit). What about the browsers which do not support this type of storage? Do you have some fallback solution or they are excluded from chat functionality? –  yojimbo87 Mar 28 '11 at 14:45
    
@yojimbo87: No, this functionality is optional. If the browser doesn't support it, every tab will poll. You can try it out in Firefox by setting dom.storage.enabled to false in about:config, for example. Also, since we currently don't use long polling, the parallel connections thing isn't really an issue for us. –  balpha Mar 28 '11 at 14:48
    
So what you basically do is that client tab periodically (with some constant timeout) checks the server for changes and reflect whatever is returned to other tabs through local storage. –  yojimbo87 Mar 28 '11 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .