Ill start off by saying this works perfectly on my local machine, the js example below connects to stream.php and receives a continuous update of the servers current time every
Sleep is blocking the SSE. I too had the same problem. I was advised to use event driven programming.