As a test, I placed the following in a php file:
Code: Select all
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache'); // recommended to prevent caching of event data.
function sendMsg($msg) {
echo "data: $msg" . PHP_EOL;
echo PHP_EOL;
flush();
}
sendMsg('server time: ' . date("h:i:s"));