跟进我的最后一个问题 -
var socket;
if ("WebSocket" in window)
{
alert("WebSocket is supported by your Browser!");
// Let us open a web socket
socket = new WebSocket("ws://localhost:10001");
}
socket.onopen() = function(){
alert("Connection Opened");
}
socket.onmessage() = function(msg){
alert(msg);
}
我可以使用 telnet 连接到服务器,但我似乎无法使用 Javascript 进行连接,这是为什么呢?