25 lines
543 B
HTML
25 lines
543 B
HTML
|
|
<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>
|