summaryrefslogtreecommitdiffstats
path: root/net/data/websocket/websocket_shared_worker.html
blob: 2156465f813f1e21f153e1e9282b74646d41832d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<html>
<body>
<div id=result></div>
<script>
function log(message)
{
  document.getElementById("result").innerHTML += message + "<br>";
}
var worker = new SharedWorker("websocket_worker_simple.js");
var protocol = location.protocol.replace('http', 'ws');
var url = protocol + '//' + location.host + '/echo-with-no-extension';
worker.port.onmessage = function (evt) {
  log(evt.data);
  if (evt.data == "DONE") {
    document.title = "OK";
  } else {
    document.title = "FAIL";
  }
};
worker.port.postMessage(url);

</script>
</body>
</html>