title: Server Sent Event and asp classic
body: <p>I made a ASP script with all headers necessary for Server Sent Events. 
  The client side script is working. I tested it with a PHP script and it works fine.
  The ASP script works and it returns the expected message if you call it from the URL line, but when the javascript calls it, the element inspector returns the data as "undefined". 
  When I set the breakpoint to the "open" event listener, the "e.data" is "undefined".</p>
  
  <p>For some reason Javascript is not accepting the UTF-8 text sent by the ASP script.</p>
  
  <p>Help me please!!!</p>
  
  <p>The asp code:</p>
  
  <pre><code>strResponse = strResponse &amp;  "data: " &amp; now() 
  response.Buffer = true
  response.CharSet = "utf-8"
  response.ContentType="text/event-stream"    
  response.AddHeader  "content-Type", "text/event-stream;charset=UTF-8"
  response.AddHeader  "Cache-Control", "no-cache"      
  response.AddHeader  "Content-Length", len(strResponse)
  response.AddHeader  "Connection", "Keep-Alive"
  response.Write strResponse
  </code></pre>
  
  <p>The Javascript:</p>
  
  <pre><code>if (!!window.EventSource) {
      var source = new EventSource('serversend.asp');
      source.addEventListener('message', function (e) {
          console.log(e.data);
      }, false);
  
      source.addEventListener('open', function (e) {
          console.log("open " + e.data);
      }, false);
  
      source.addEventListener('error', function (e) {
          if (e.readyState == EventSource.CLOSED) {
              console.log(e.data);
          }
      }, false);
  
  
  
  } else {
      // something else :(
  }
  </code></pre>
  
  <p>Thank you!</p>