Skip to content

clients connect bu disconnect and reconnect every 3 seconds. #186

Closed
@ezesolares

Description

@ezesolares

Hello.

First, thanks for a great library... now to the problem in hand
I'm having my clients keep disconnecting and connecting (every 3 seconds)
my configuration is based on the documents (redis nginx and uwsgi).

My setup is as follow

*nginx *

server {
    listen          81;
    charset UTF-8;
    server_name _;
    access_log /var/log/nginx/hpo.com_access.log;
    error_log /var/log/nginx/hpo.com_error.log warn;

    location / {
        include /etc/nginx/uwsgi_params;
        uwsgi_pass unix:/run/uwsgi/app/hpo.com/hpo.com.socket;
    }

    location /ws/ {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass http://127.0.0.1:3032;
    }
}

uwsgi

websocket
uwsgi --plugin=gevent --virtualenv /home/rtas/webapp/webapp/ --http-socket 127.0.0.1:3032 --chmod=777  --gevent=1000 --http-websockets --workers=2 --master --vacuum --module wsgi_websocket:applicatio

django

uwsgi --virtualenv /home/rtas/webapp/webapp/ --socket /run/uwsgi/app/hpo.com/hpo.com.socket --buffer-size=32768 --workers=5 --master --chmod=777 --module wsgi_djang

Port sniffing

nginx <-> wsgi_websocket.py

now sniffing the websocket port (nginx <-> wsgi_websocket) in port 3032

HTTP/1.1 101 Web Socket Protocol Handshake
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Origin: http://127.0.0.1:81
Sec-WebSocket-Accept: FnMhrzasPZUnyrbyZysqNpHRU4Y=




j
'NoneType' object has no attribute 'encode'
GET /ws/hpo?subscribe-broadcast&publish-broadcast&echo HTTP/1.1
Upgrade: websocket
Connection: upgrade
Host: 127.0.0.1:3032
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Sec-WebSocket-Version: 13
Origin: http://127.0.0.1:81
Sec-WebSocket-Extensions: permessage-deflate
Sec-WebSocket-Key: g3jCU79R3KTj7weqCWtP5A==
Cookie: csrftoken=qgMrsgJQFPhvNnLqahmaNat533R5EyGq; sessionid=rglexjsepgy0x8m45k8rb34u5xdzjsg1
Pragma: no-cache
Cache-Control: no-cache

wsgi_websocket <-> redis

and the communication between wsgi_websocket app and redis (in port 6379)

$9
subscribe
$17
hpo:broadcast:hpo
:1

*2
$3
GET
$17
hpo:broadcast:hpo

$-1

*1
$11
UNSUBSCRIBE

*2
$9
SUBSCRIBE
$17
hpo:broadcast:hpo

*3
$9
subscribe
$17
hpo:broadcast:hpo
:1

*2
$3
GET
$17
hpo:broadcast:hpo

$-1

I cant find the problem.. the 'NoneType' object has no attribute 'encode' that shows in the nginx <-> wsgi_django app is bothering me but i added utf-8 in the nginx setup thinking it may be that .. still cant find the right answer.

The setup is a newly installed ubuntu 15.10 with everything updated (nginx from ubuntu package, uwsgi from pip)

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions