deb-websockify/wsirc.html
Joel Martin b54cba86c7 Use websock.js in latency test. Fixes for Opera.
Convert latency test to use include/websock.js instead of direct
WebSockets handling.

Add support for configuring the maximum bufferedAmount. This allows us
to configure it high enough to get around a bug in bufferedAmount
reporting in Opera.

Add some latency test results for Opera 11 with WebSockets turned on.
2011-01-23 19:30:51 -06:00

100 lines
3.3 KiB
HTML

<html>
<head>
<title>IRC Client using WebSockets</title>
<script src="include/base64.js"></script>
<script src="include/websock.js"></script>
<script src="include/util.js"></script>
<script src="include/webutil.js"></script>
<script src="include/keysym.js"></script>
<script src="include/VT100.js"></script>
<script src="include/wsirc.js"></script>
<!-- Uncomment to activate firebug lite -->
<!--
<script type='text/javascript'
src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
-->
</head>
<body>
Host: <input id='host' style='width:100'>&nbsp;
Port: <input id='port' style='width:50'>&nbsp;
Encrypt: <input id='encrypt' type='checkbox'>&nbsp;
<input id='connectButton' type='button' value='Connect' style='width:100px'>
<br>
Nick: <input id='nick' style='width:120'>&nbsp;
<br>
Channel: #<input id='channel' style='width:70'>&nbsp;
<br><br>
<div><pre id="irc"></pre></div>
&gt;
<input id="msg" type="text" size=80 onkeypress="sendMsg();">
<script>
var irc;
function sendMsg() {
if (event.keyCode === 13) {
var msg = $D('msg').value;
$D('msg').value = "";
Util.Debug("calling sendMsg('" + msg + "')");
irc.sendMsg(msg);
}
}
function connect() {
var ret;
ret = irc.connect($D('host').value,
$D('port').value,
$D('encrypt').checked,
$D('nick').value,
$D('channel').value);
if (! ret) { return false; }
$D('connectButton').disabled = true;
$D('connectButton').value = "Connecting";
}
function disconnect() {
$D('connectButton').disabled = true;
$D('connectButton').value = "Disconnecting";
irc.disconnect();
}
function connected() {
$D('msg').disabled = false;
$D('connectButton').disabled = false;
$D('connectButton').value = "Disconnect";
$D('connectButton').onclick = disconnect;
}
function disconnected() {
$D('msg').disabled = true;
$D('connectButton').disabled = false;
$D('connectButton').value = "Connect";
$D('connectButton').onclick = connect;
}
window.onload = function() {
console.log("onload");
var url = document.location.href;
$D('host').value = (url.match(/host=([^&#]*)/) || ['',''])[1];
$D('port').value = (url.match(/port=([^&#]*)/) || ['',''])[1];
$D('nick').value = (url.match(/nick=([^&#]*)/) || ['',''])[1];
$D('channel').value = (url.match(/channel=([^&#]*)/) || ['',''])[1];
disconnected();
irc = IRC('irc', connected, disconnected);
}
</script>
</body>
</html>