3
파이썬에서 간단한 WebSocket 서버를 만들었지 만 Chrome 4.0.249.78 dev (36714)는 핸드 셰이크 후에 항상 연결을 끊습니다. 내 코드가 아니 었는지 확인하기 위해 https://stackoverflow.com/questions/2153294?tab=newest#tab-top에있는 WebSocket 서버를 사용하여이를 테스트했으며 같은 결과를 얻었습니다 (아래). 여기websocket의 악수 후, 크롬 연결이 끊어졌습니다. 도메인 불일치 때문입니까? 아니면 크롬 버그?
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');
}
다른 사람이 문제로 실행 중이거나이 도메인 불일치 문제가 될 것으로 보인다 않는 ... 자바 스크립트입니까?