WebSocket html客户端

<script>


var ws = new WebSocket("ws://114.215.103.25:9501");

ws.onopen = function(){ 
	console.log("握手成功");
	};

ws.onmessage = function(messageEvent){
	console.debug(messageEvent.data);
};

ws.onerror = function(errorEvent){
    console.log(errorEvent);
};

ws.onclose = function(closeEvent){
	console.log(closeEvent);
};
</script>


你可能感兴趣的:(function,客户端)