html页面
<!DOCTYPE html>
<html>
<head>
<title>abc</title>
</head>
<body>
<script type="text/javascript">
var sock = null;
var wsuri = "ws://localhost:8080/a";
window.onload = function() {
sock = new WebSocket(wsuri);
//建立连接后触发
sock.onopen = function() {
console.log(" 建立连接后触发 connected to " + wsuri);
}
// 关闭连接时候触发
sock.onclose = function(e) {