How to fully implement server-sent events for message polling
问题 I am trying to communicate with a server using an API. to make it easier I wrote a script that will communicate the API using a php script. My goal is to make a query to the API every second to see if there is new message in their queue. I was advised to use server-sent events method and have the server send a respond to the client only when it has something new. Here is my php script <?php // Register autoloader function spl_autoload_register('apiAutoloader'); header("Content-Type: text