I can't connect to websockets from my domain. How can I resolve this?

341 views Asked by At

I am unable to connect to any websockets from clients at my webapp's domain. I am serving the web app using Hypercorn.

I know the websocket for my app is working because I can connect to it from another domain:

// From a client at another domain, this works!

    let ws = new WebSocket("ws://mysite/endpoint"); 
    ws.onopen = function() {
        alert("Connection established");
    };

I can't connect to any websockets from my domain. The example below is a test socket:

// Doesn't work when this is run at my domain.

    let ws = new WebSocket("wss://echo.websocket.org"); 
    ws.onopen = function() {
        alert("Connection established");
    };

Oddly enough, the (server side) debugger output on my site's websocket shows that connections from my domain are being made. However, I am unable to receive any data from the client. The client does not indicate any connection has been made.

I've never run into this before. But, my guess is there's some server config piece that I'm missing. Any suggestions are much appreciated.

0

There are 0 answers