summaryrefslogtreecommitdiffstats
path: root/dom/base/test/eventsource_message.sjs
blob: d52e2ee4322b466dff2d3a02fd71d3cd9f4a52ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
function handleRequest(request, response) {
  var match = request.queryString.match(/^status=(.*)$/);
  var status = match ? +match[1] : 200;

  if (status != 200) {
    response.setStatusLine(request.httpVersion, status, "Err");
  }
  response.setHeader("Content-Type", "text/event-stream");
  response.setHeader("Cache-Control", "no-cache");
  response.write("data: msg 1\n");
  response.write("id: 1\n\n");
}