title: EventSource's response has a MIME type ("text/html") that is not "text/event-stream". Aborting the connection. header is set to text/event-stream
body: <p>Hi I get This error in my console using sse</p>
  
  <p>EventSource's response has a MIME type ("text/html") that is not "text/event-stream". Aborting the connection.</p>
  
  <p>js code is :</p>
  
  <pre><code>if (typeof(EventSource) !== "undefined") 
  {
      var source = new EventSource("../api/updateWellData.php?uid=&lt;?php echo $node_id ?&gt;");
      source.onmessage = function(event) {
          var response = JSON.parse(event.data);
          document.getElementById("result").innerHTML = response.test;
          // some code like the above line
      };
  }  
  else 
  {
      // refresh the page every 30 secs
  } 
  </code></pre>
  
  <p>The PHP Code is :</p>
  
  <pre><code>header('Cache-Control: no-cache');
  header("Access-Control-Allow-Origin: *");
  header("Content-Type: text/event-stream");
  
  require_once("../resources/config.php");
  
  if (isset($_GET['uid']))
  {
      $uid = $_GET['uid'];
      while (1) 
      {
          $query = Query("SELECT * FROM well_data_last WHERE well_detail_id = $uid");
          $result = fetch_array($query);
          echo json_encode($result);
          ob_end_flush();
          flush();
          sleep(1);
      }
  }
  </code></pre>
  
  <p>This is my first time using sse I used the following documents : <a href="https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events" rel="noreferrer">mozilla</a> | <a href="https://www.w3schools.com/html/html5_serversentevents.asp" rel="noreferrer">w3schools</a></p>