1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-30 00:00:16 +01:00
libwebsockets/test-server/test.html
Andy Green 7310e9c77b refactor-into-dirs.patch
Signed-off-by: Andy Green <andy@warmcat.com>
2010-11-01 09:12:17 +00:00

39 lines
824 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8 />
<title>Minimal Websocket message sender</title>
</head>
<body>
<script>
var pos = 0;
var socket = new WebSocket("ws://127.0.0.1:7681");
try {
// alert('<p class="event">Socket Status: '+socket.readyState);
socket.onopen = function(){
// alert('<p class="event">Socket Status: '+socket.readyState+' (open)');
}
socket.onmessage = got_packet;
socket.onclose = function(){
alert('<p class="event">Socket Status: (Closed)');
}
} catch(exception){
alert('<p>Error'+exception);
}
function got_packet(msg){
// alert('got packet' + msg.data);
document.body.textContent = msg.data + "\n";
}
</script>
</body>
</html>