surrealpatch/tpl/index.html
Tobie Morgan Hitchcock de72e40789 Update gitignore
2016-04-04 00:12:35 +01:00

36 lines
No EOL
805 B
HTML

<!DOCTYPE html>
<meta charset="utf-8" />
<title>WebSocket</title>
<script>
var uri = "ws://127.0.0.1:8000/rpc";
function init() {
websocket = new WebSocket(uri);
websocket.onopen = function(evt) {
document.getElementById('output').innerHTML = '<span style="color:#00CC00;">Connected</span>';
};
websocket.onclose = function(evt) {
document.getElementById('output').innerHTML = '<span style="color:#FF0000;">Disconnected</span>';
};
websocket.onmessage = function(evt) {
console.log(evt.data)
};
websocket.onerror = function(evt) {
console.warn(evt.data)
};
}
window.addEventListener("load", init, false);
</script>
<h2>WebSocket</h2>
<div id="output"></div>