title: Server-side-event C++ implementation?
body: <p>I'm trying to implement a C++ server to generate event for a javascript EventSource, I'm building it with cpprest. From the examples I've seen in PHP or Node.js, it looked pretty straight-forward but I must be missing something since I'm getting this in the Firefox console:</p>
  
  <pre><code>Firefox can’t establish a connection to the server at http://localhost:32123/data.
  </code></pre>
  
  <p>With Postman, I'm correctly receiving <code>"data : test"</code> so I think I'm missing some continuation, probably have to do something more than just reply to the request, but I didn't find a good explanation on how this is supposed to work yet. If you have some documentation you could point me to, that would be greatly appreciated!</p>
  
  <p>The html page script looks like this:</p>
  
  <pre><code>var source = new EventSource("http://localhost:32123/data");
  
  source.onmessage = function (event) {
      document.getElementById("result1").innerHTML += event.data + "&lt;br&gt;";
  };
  </code></pre>
  
  <p>The C++ server reponse :</p>
  
  <pre><code>wResponse.set_status_code(status_codes::OK);
  wResponse.headers().add(U("Access-Control-Allow-Origin"), U("*"));
  wResponse.set_body(U("data: test"));
  iRequest.reply(wResponse);
  </code></pre>
  
  <p>And the request my server is receiving:</p>
  
  <pre><code>GET /data HTTP/1.1
  Accept: text/event-stream
  Accept-Encoding: gzip, deflate
  Accept-Language: en-us, en;q=0.5
  Cache-Control: no-cache
  Connection: keep-alive
  Host: localhost:32123
  Origin: null
  Pragma: no-cache
  User-Agent: Mozilla/5.0 (Windows NT6.1; Win64, x64; rv:61.0) Gecko/20100101 Firefox/61.0
  </code></pre>