<?php while (1) { // Every second, sent a "ping" event. echo "event: ping\n"; echo 'data: {"time": "' . $curDate . '"}'; echo "\n\n"; // Send a simple message at random intervals. $counter--; if (!$counter) { echo 'data: This is a message at time ' . $curDate . "\n\n"; } } ?>
Standard input is empty
event: ping data: {"time": "2013-10-06T19:47:26-0400"} event: ping data: {"time": "2013-10-06T19:47:27-0400"} event: ping data: {"time": "2013-10-06T19:47:28-0400"} event: ping data: {"time": "2013-10-06T19:47:29-0400"} event: ping data: {"time": "2013-10-06T19:47:30-0400"} event: ping data: {"time": "2013-10-06T19:47:31-0400"} event: ping data: {"time": "2013-10-06T19:47:32-0400"} event: ping data: {"time": "2013-10-06T19:47:33-0400"} event: ping data: {"time": "2013-10-06T19:47:34-0400"} data: This is a message at time 2013-10-06T19:47:34-0400 event: ping data: {"time": "2013-10-06T19:47:35-0400"} event: ping data: {"time": "2013-10-06T19:47:36-0400"} data: This is a message at time 2013-10-06T19:47:36-0400
PHP Notice: ob_flush(): failed to flush buffer. No buffer to flush in /home/Oxluqz/prog.php on line 23 PHP Notice: ob_flush(): failed to flush buffer. No buffer to flush in /home/Oxluqz/prog.php on line 23 PHP Notice: ob_flush(): failed to flush buffer. No buffer to flush in /home/Oxluqz/prog.php on line 23 PHP Notice: ob_flush(): failed to flush buffer. No buffer to flush in /home/Oxluqz/prog.php on line 23 PHP Notice: ob_flush(): failed to flush buffer. No buffer to flush in /home/Oxluqz/prog.php on line 23 PHP Notice: ob_flush(): failed to flush buffer. No buffer to flush in /home/Oxluqz/prog.php on line 23 PHP Notice: ob_flush(): failed to flush buffer. No buffer to flush in /home/Oxluqz/prog.php on line 23 PHP Notice: ob_flush(): failed to flush buffer. No buffer to flush in /home/Oxluqz/prog.php on line 23 PHP Notice: ob_flush(): failed to flush buffer. No buffer to flush in /home/Oxluqz/prog.php on line 23 PHP Notice: ob_flush(): failed to flush buffer. No buffer to flush in /home/Oxluqz/prog.php on line 23 PHP Notice: ob_flush(): failed to flush buffer. No buffer to flush in /home/Oxluqz/prog.php on line 23