text: Trying to get a basic server-sent-event working with express.js on server side:
  
  index.js:
  
  const app        = require('express')();
  const index_html = require('path').join(__dirname, 'index.html');
  
  app.get('/', (req, res) =>
  {
      res.sendFile(index_html);
  });
  
  app.get('/data', (req, res) =>
  {
      res.header('Cache-Control', 'no-cache');
      res.header('Content-Type', 'text/event-stream');
  
      setInterval(() =>
      {
          res.write(new Date().toISOString() + '\n\n');
      }, 1000);
  });
  
  app.listen('7000');
  index.html:
  
  <!doctype html>
  <head>
      <title>Hello World</title>
  </head>
  <body>
      <h1 id='result'>No Data Yet</h1>
      <script>
      var source = new EventSource('data');
      source.onmessage = function(event)
      {
          console.log('invoked');
          document.getElementById('result').innerHTML = event.data + '<br>';
      };
      </script>
  </body>
  The source.onmessage never triggers.