<html>
<head>
<meta charset="utf-8"/>
<title>stWebsocketServer</title>
</head>
<body>
<script>
function Test(){
//1//if (window.WebSocket){}
if ("WebSocket" in window){
alert("support");
var ws = new WebSocket("ws://echo.websocket.org");
ws.onopen = function(e){
ws.send("send data");
alert("sending ");
}
ws.onmessage = function(e){
var msg = e.data;
alert("msg received: " + msg);
}
ws.onclose = function(e){
alert("close")
}
ws.onerror = function(e){
alert("error");
}
} else {
alert("not support");
}
}
Test();
//window.addEventListener('load','Test',false);
</script>
</body>
</html>