我设计了一个使用sse的网站。调用一个php文件,大致如下:
session_name('kflow'); session_start();
$file = $_SESSION['somefile'];
session_write_close(); // to avoid the hang
$oldcontent = file_get_contents($file);
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
header('Connection: keep-alive');
while(TRUE) {
$content = file_get_contents($file);
if ($content != $oldcontent) {
$oldcontent = $content;
push_to_sse($somedata);
}
usleep($somelittlenap);
}
所有这一切都在法国,在多种环境中完美运作,包括在我的法语macbookpro上。然后我到达弗里斯科,买了一台iMac。仍然可以在macbookpro上完美运行,它挂在iMac上,就像没有session_write_close一样。试过另一个iMac:同样的事情。在另一个局域网上尝试:同样的事情。所有都有相同的浏览器(Firefox或Chrome);所有浏览器都有相同的版本,没有扩展名。网络设置相同(无代理,无防火墙)。所有这些都在同一个局域网上,并且仍然是:只有法语macbook pro可以工作,所有其他计算机都挂起......
如何调试这个谜团?
非常感谢! 最好