jrief / django-websocket-redis

Websockets for Django applications using Redis as message queue
http://django-websocket-redis.awesto.com/
MIT License
896 stars 222 forks source link

Getting ERR_NOT_IMPLEMENTED #196

Closed naglalakk closed 8 years ago

naglalakk commented 8 years ago

All of a sudden I'm getting this error

'ws://46.101.214.177/ws/foobar?subscribe-broadcast&publish-broadcast&echo' failed: Error in connection establishment: net::ERR_NOT_IMPLEMENTED

Strange thing is that on friday I used the exact same url and it worked.

The setup I'm using is the one described here: https://github.com/jrief/django-websocket-redis/blob/master/docs/running.rst

where I have two uwsgi processes running, one for django and one for websockets. I've seen people mention this error in connection with https but I'm not trying to connect through https.

I have verified that both uwsgi processes are up and running. This is very likely something connected to my setup but if anyone has experienced this issue before it would be great to know and hear what you did to solve this.

thank you

jrief commented 8 years ago

this is an error reported by the browser, isn't it? May it be that your browser upgraded itself? Did you run the browser against the demo site? With so litte information, for me it is nearly impossible to reproduce that error in my local environment.

naglalakk commented 8 years ago

Hi thank you for your reply. I don't think this is due to browser updates because when running locally with the url: ws://127.0.0.1:8080/ws/ connects without issues.

The access.log from nginx is giving me similar jargon as one gets when trying to connect to https without the address actually being secured by https:

178.162.216.30 - - [30/May/2016:09:02:11 -0400] "\x80\x03\x00\x04\x00\x00\x00\x14\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x03\xE8\x00\x00\x00\x07\x00`\x00\x00\x80\x03\x00\x09\x00\x00\x00\x08\x00\x00\x00\x00\x00\xEF\x00\x00" 400 181 "-" "-"

There are sites running with ssl protection on the same server. I wonder if this is interference between nginx configs. My nginx config is:

server {
     server_name localhost;
     listen 80 default_server;
     location / {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        include /etc/nginx/uwsgi_params;
        uwsgi_pass unix:/tmp/django.socket;
    }

    location /ws/ {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass http://unix:/tmp/web.socket;
    }
}

The uwsgi config for websockets

uwsgi:
    uid: www-data
    gid: www-data
    chmod-socket: 666
    chown-socket: www-data:www-data
    workers: 2
    chdir: /home/donna/kott/beinlina/beinlina
    virtualenv: /home/donna/kott/beinlina/venv
    module: wsgi_websocket:application
    env: DJANGO_SETTINGS_MODULE=config.production
    env: DJANGO_CONFIGURATION=Production
    master: True
    vacuum: True
    gevent: 1000
    http-socket: /tmp/web.socket
    http-websockets: True
    pidfile: /tmp/%n.pid
    daemonize: /var/log/uwsgi/%n.log
    touch-reload: /home/donna/kott/beinlina/uwsgireload
naglalakk commented 8 years ago

Hi again I think I have discovered why this is happening. The answer is found here: http://stackoverflow.com/questions/7929460/django-400-bad-request-syntax-what-does-this-message-mean

for some reason django is trying to connect through https. Anyway it seems clear that this error is not caused by this library. Thank you for a quick reply. I will close this case now.