Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
44 lines (38 sloc) 1.31 KB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="jquery.slws.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
setTimeout(connect, 250);
});
function connect() {
if (window.WebSocket) {
// Native
websocket = new WebSocket('ws://localhost:4503/reverse');
} else {
websocket = new WebSocketDraft('ws://localhost:4503/reverse');
}
websocket.onopen = function () {
$('body').append('Connected.');
$('#inputbox').keyup(function () {
websocket.send($('#inputbox').val());
});
};
websocket.onclose = function () {
$('body').append('Closed.');
};
websocket.onmessage = function (event) {
$('#outputbox').val(event.data);
};
}
</script>
</head>
<body>
<input id="inputbox" />
<br />
<input id="outputbox" />
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.