I'm doing this with Server-Sent Event,
and I have a problem which is I can only open the same page at the same time
for one not two or more(because they will only load it until the current page stopped),
and it's not something about session_write_close() also.
Here's the code that I tested on my server
(with two different server, XAMPP & EasyPHP and OSX built-in PHP too),
I rename it to "test.php":
<?php
set_time_limit(0);
while(true)
{
echo time() . '<br>';
ob_flush();
flush();
sleep(1);
}
?>
When I running test.php, it looks everything going well,
but if I open the same page in another tab, it's just gave me nothing(freezing),
Can anyone tell me what's wrong? Is there an limit for this?
EDIT: 2014/10/10
Although this code is not in the demo, but it looks like it's occurred when
header('Cache-Control: no-cache');
was existed in your code, maybe it's Google Chrome bug, I will check it out sooner..
--
SOLUTION
This problem only occurred on Google Chrome, so I change
header('Cache-Control: no-cache');
to
header('Cache-Control: no-store, no-cache, must-revalidate');
and it's worked, until you reach the limit connection per IP in Apache config
or the max connections per server of browser :D