Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 与websocket握手后,chrome将断开连接。这是因为域不匹配吗?还是Chrome bug?_Javascript_Python_Google Chrome_Websocket - Fatal编程技术网

Javascript 与websocket握手后,chrome将断开连接。这是因为域不匹配吗?还是Chrome bug?

Javascript 与websocket握手后,chrome将断开连接。这是因为域不匹配吗?还是Chrome bug?,javascript,python,google-chrome,websocket,Javascript,Python,Google Chrome,Websocket,我用Python制作了自己的简单WebSocket服务器,但Chrome4.0.249.78开发版(36714)总是在握手后断开连接。为了确保它不是我的代码,我使用在找到的WebSocket服务器对其进行了测试,并得到了相同的结果(如下) 是否有其他人遇到此问题,或者这似乎是一个域不匹配问题?我将Chrome升级到一个新版本(4.0.302.3 dev),现在控制台中出现了正确的javascript错误。这确实是一个域不匹配错误 如果其他人遇到同样的问题,请确保首先更新浏览器,然后检查URL l

我用Python制作了自己的简单WebSocket服务器,但Chrome4.0.249.78开发版(36714)总是在握手后断开连接。为了确保它不是我的代码,我使用在找到的WebSocket服务器对其进行了测试,并得到了相同的结果(如下)


是否有其他人遇到此问题,或者这似乎是一个域不匹配问题?

我将Chrome升级到一个新版本(4.0.302.3 dev),现在控制台中出现了正确的javascript错误。这确实是一个域不匹配错误

如果其他人遇到同样的问题,请确保首先更新浏览器,然后检查URL

listening...
connection!
GET / HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: localhost:1234
Origin: http://localhost


handshaken
got:
got:
Traceback (most recent call last):
  File "test.py", line 44, in <module>
    start_server()
  File "test.py", line 18, in start_server
    interact(csock, tick)
  File "test.py", line 40, in interact
    send_data(client, "clock ! tick%d" % (tick))
  File "test.py", line 25, in send_data
    return client.send(str)
socket.error: [Errno 10053] An established connection was aborted by the softwar
e in your host machine
Press any key to continue . . .
if ("WebSocket" in window) {
    var ws = new WebSocket("ws://localhost:1234");
    ws.onopen = function() {
        alert('opened');
        ws.send("test");
    }
    ws.onmessage = function (evt) {
        alert('hit');
        $('#game').html(evt.data);
    }
    ws.onclose = function () {
        $('#game').html('Lost Connection');
    }
} else {
    $('#game').html('No support');
}