Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: 8.2-compatibil…
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (34 sloc) 1.265 kB
<html>
<head>
<title>Twisted WebSocket Test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ></script>
<script language='javascript'>
$(document).ready(function() {
var ws;
if (typeof MozWebSocket != "undefined") {
ws = new MozWebSocket("ws://localhost:8080/test");
} else {
ws = new WebSocket("ws://localhost:8080/test");
}
ws.onmessage = function(evt) {
$('#output').text(evt.data);
}
ws.onopen = function(evt) {
$('#conn_status').html('<b>Connected</b>');
ws.send('Test data');
}
ws.onerror = function(evt) {
$('#conn_status').html('<b>Error</b>');
}
ws.onclose = function(evt) {
$('#conn_status').html('<b>Closed</b>');
}
});
</script>
</head>
<body>
<h1>WebSocket in Twisted Test</h1>
<div id="conn_status">Not Connected</div>
<div id="output"></div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.