1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-30 00:00:16 +01:00
libwebsockets/test.html
Andy Green 4ea6006451 implement-v76-write-and-recognize-close-req.patch
Signed-off-by: Andy Green <andy@warmcat.com>
2010-10-30 12:15:07 +01:00

39 lines
812 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.write(msg.data + "\n");
}
</script>
</body>
</html>