This commit is contained in:
Matthias Janetschek
2015-05-29 15:35:53 +02:00
parent 7905105701
commit 8f844218be
11 changed files with 321 additions and 49 deletions
@@ -3,22 +3,27 @@
<head>
<title>WebSocketServer</title>
<script type="text/javascript">
var ws;
function WebSocketTest() {
if ("WebSocket" in window) {
var ws = new WebSocket("ws://127.0.0.1:8080/ws");
ws = new WebSocket("ws://127.0.0.1:8080/hos/api/websocket");
ws.onopen = function() { ws.send("Hello, world!"); };
ws.onmessage = function(evt) {
var msg = evt.data;
alert("Message received: " + msg);
ws.close();
};
ws.onclose = function() {
alert("WebSocket closed.");
};
};
setTimeout(timeoutFunc, 3000);
} else {
alert("This browser does not support WebSockets.");
}
}
function timeoutFunc() {
ws.send("Hello, world2!");
setTimeout(timeoutFunc, 3000);
}
</script>
</head>