Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: ac6dddc1ff
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (29 sloc) 0.879 kb
<html>
<title>Dante</title>
<head>
<script>
var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://';
var address = protocol + window.location.host + window.location.pathname + '/ws';
var socket = new WebSocket(address);
var body;
function addLine(line) {
body = body || document.getElementsByTagName('body')[0];
var div = document.createElement('div');
div.appendChild(document.createTextNode(line));
body.appendChild(div);
}
socket.onmessage = function (msg) {
addLine(msg.data);
};
socket.onerror = function (e) {
addLine('Unable to establish WebSocket connection to ' + address);
};
socket.onclose = function () {
addLine('WebSocket connection is closed.');
};
</script>
</head>
<body>
<h1>Dante over WebSockets</h1>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.