+++ /dev/null
-<!DOCTYPE HTML>
-<html lang="en">
-
-<head>
-<meta charset='utf-8'>
-<title>uMurmurd Websocket demo HTML page</title>
-<link rel="stylesheet" href="css/mon_umurmurd.css" >
-<link rel="stylesheet" href="css/json.human.css" >
-</head>
-
-<body>
-
-<div id="output"> </div>
-<input type=button id=offset value="Update" onclick="update();">
-<input type=button id=offset value="AutoUpdate" onclick="autoupdate();">
-<script src="/js/jquery.min.js"></script>
-<script src="/js/crel.js"></script>
-<script src="/js/json.human.js"></script>
-<script>
-
- function convert(input, output) {
- var output = document.getElementById("output"),
- raw = document.getElementById("output-raw");
- var node = JsonHuman.format(input);
-
- output.innerHTML = "";
- output.appendChild(node);
-
- }
-
-</script>
-<script>
-
-function get_appropriate_ws_url()
-{
- var pcol;
- var u = document.URL;
- var m, s;
- //document.writeln( u + "<br>" );
-
- /*
- * We open the websocket encrypted if this page came on an
- * https:// url itself, otherwise unencrypted
- */
-
- if (u.substring(0, 5) == "https") {
- pcol = "wss://";
- u = u.substr(8);
- } else {
- pcol = "ws://";
- if (u.substring(0, 4) == "http")
- u = u.substr(7);
- }
-
- u = u.split('/');
- m = u[0].split(':');
-
- /* + "/xxx" bit is for IE10 workaround */
- /* ":7681" bit makes this function work even if this html file gets served from another server */
- /* browser may complain about it but it works in firefox 30.0. If you do this umurmurd_websocket */
- /* will just act as the websocket server. I will make a reduced down version of the server if */
- /* enough people request it */
- return pcol + m[0] + ":7681" + "/xxx";
-}
- var socket_json;
- var json_data;
-
- if (typeof MozWebSocket != "undefined") {
- socket_json = new MozWebSocket(get_appropriate_ws_url(),
- "umurmurd-json-protocol");
- } else {
- socket_json = new WebSocket(get_appropriate_ws_url(),
- "umurmurd-json-protocol");
- }
-
-
- socket_json.onopen = function() {
- socket_json.send("update\n");
- }
- socket_json.onmessage = function (jmsg) {
-
- json_data = JSON.parse(jmsg.data);
-
- convert(json_data, output);
-
- }
- socket_json.onclose = function(){
-
- }
-function update() {
- socket_json.send("update\n");
-}
-function autoupdate() {
- socket_json.send("autoupdate\n");
-}
-</script>
-</body>
-</html>
\ No newline at end of file