views:

540

answers:

1

I made my own simple WebSocket server in Python but Chrome 4.0.249.78 dev (36714) ALWAYS disconnects after the handshake. To make sure it wasn't my code I used the WebSocket server found at http://stackoverflow.com/questions/2153294?tab=newest#tab-top to test it and got the same result (below).

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 . . .

Here is the Javascript...

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');
}

Is anyone else running into this problem or does this appear to be a domain mismatch issue?

A: 

I upgraded Chrome to a new build (4.0.302.3 dev) and now I am getting proper javascript errors in the console. It was indeed a domain mismatch error.

To anyone else getting this same issue, make sure to update your browser first and then check your urls.

Pykedout