Commit 0385e011 authored by Joel Martin's avatar Joel Martin

Remove old test files.

parent cc0410a3
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Web Sockets echo test</title>
<meta charset="UTF-8">
<script src="include/mootools.js"></script>
<script src="include/mootools-more.js"></script>
<script>
var cnt = 0;
var s = null;
var timer = null;
function debug(str) {
cell = $('debug');
cell.innerHTML += str + "<br/>";
}
function send_data() {
debug(">> send_data: testing " + cnt);
s.send("testing " + cnt);
cnt ++;
}
window.onload = function() {
debug(">> window.onload");
var uri = new URI(window.location);
var host = uri.getData("host");
var port = uri.getData("port");
if ((!host) || (!port)) {
debug("must set host and port");
return;
}
var location = "ws://" + host + ":" + port
debug("connecting to " + location);
s = new WebSocket(location);
s.onmessage = function(e) {
debug(">> onmessage: " + e.data);
};
s.onopen = function(e) {
debug(">> onopen" + e);
timer = send_data.periodical(1000);
};
s.onclose = function(e) {
debug(">> onclose: " + e);
if (timer) {
timer = $clear(timer);
}
debug("<< onclose: " + e);
}
debug("<< window.onload");
};
</script>
</head>
<body>
Debug:
<div id="debug" style="width:600px;height:300px"></div>
</body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Web Sockets echo test</title>
<meta charset="UTF-8">
<script src="include/mootools.js"></script>
<script src="include/mootools-more.js"></script>
<script>
var cnt = 0;
var s = null; var timer = null;
function debug(str) {
cell = $('debug');
cell.innerHTML += str + "<br/>";
}
function send_data() {
var entry = $('entry');
debug(">> send: " + entry.value);
s.send(entry.value + "\n");
entry.value = ""; // Clear it
return true;
}
window.onload = function() {
debug(">> window.onload");
var uri = new URI(window.location);
var host = uri.getData("host");
var port = uri.getData("port");
if ((!host) || (!port)) {
debug("must set host and port");
return;
}
var location = "ws://" + host + ":" + port
debug("connecting to " + location);
s = new WebSocket(location);
s.onmessage = function(e) {
debug(">> onmessage");
var out = $("out");
out.innerHTML = out.innerHTML + e.data;
};
s.onopen = function(e) {
debug(">> onopen");
};
s.onclose = function(e) {
debug(">> onclose");
if (timer) {
timer = $clear(timer);
}
debug("<< onclose");
}
debug("<< window.onload");
};
</script>
</head>
<body>
<h1>Web Sockets Interactive</h1>
<fieldset>
<h3>Server output:</h3>
<pre>
<div id="out"></div>
</pre>
</fieldset>
<p>Enter something in the entry below to send to the server.</p>
<fieldset>
<p>Enter: <input id="entry" onkeypress="{if (event.keyCode==13) send_data()}" size="42"></p>
<!-- <p>Enter: <input id="entry" onchange="send_data()" onkeypress="{if (event.keyCode==13) send_data()}" size="42"></p> -->
</fieldset>
<br><br>
Debug:
<div id="debug" style="width:600px;height:300px"></div>
</body>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment