javascriptphpcometreverse-ajax

How to run comet chat in parallel tabs


I have developed a chat site which uses reverse-ajax/COMET with php backend and works pretty well, but when I run a page in two parallel tabs of the same browser, the response slows down because the 2nd tab waits for the 1st tab to finish its execution and then the 1st tab waits for the 2nd. As a result, the site really slows down.

So PHP doesn't support simultaneous execution. How do I fix this problem?


Solution

  • You must understand that PHP is server-side and Javascript is client-side. Your browser runs on client-side, which theoretically is running on computer A, while the PHP code, which is server-side code runs on computer B. As a result, it should not matter whether you are opening n tabs on the same browser to run the page or you are opening n different browsers. PHP should run without problems, two tabs should not really affect scalability. I believe you have one or more bugs in your code which leads to this problem.