Closed ezesolares closed 8 years ago
sorry, I can't follow on this. Are you sure there is no proxy or whatever in between?
well, its all on the same computer and nginx acts in between.. its redis <-> wsgi_websocket.py <-> nginx <-> webapp,
I have almost the same setup from the project documents.. except i'm using a socket and not an unix socket for wsgi_websocket and nginx because i wanted to sniff what was happening in between. I'll edit the question better, sorry.. i was running out of time when i posted before having to go to a meeting.
@ezesolares , I believe that it is happening because your websocket server address:port (127.0.0.1:3032) is different from the app server (127.0.0.1:81), which conflicts with the SESSION_COOKIE_DOMAIN name. I faced the same problem when a I had to put the websocket server in a different host address.
If this is your problem, this pull request must fix it: #185. More info in this issue #184. However, maybe only setting the SESSION_COOKIE_DOMAIN name fixes your problem.
@yguarata Well, i had the same issue using unix sockets.... i changed to use sockets only to be able to sniff what was going there using tcpdump. I'll check the pull request
Updated documentation about this: https://github.com/yguarata/django-websocket-redis/blob/master/docs/installation.rst#running-websockets-in-cross-domains
@yguarata i added your pull request but its the same.. i tried using SESSION_COOKIE_DOMAIN='127.0.0.1' and then, also added WEBSOCKET_HOST='127.0.0.1' to my project settings and nothing changes. Connection keep reseting itself, connect and disconnect loop.
Did you try WEBSOCKET_HOST='127.0.0.1:3230'?
I did tried, same thing
Connecting to ws://127.0.0.1:3032/ws/hpo?subscribe-broadcast&publish-broadcast&echo ... ws4redis.js (line 18) Connected! ws4redis.js (line 46) Connection closed! ws4redis.js (line 57) Connecting to ws://127.0.0.1:3032/ws/hpo?subscribe-broadcast&publish-broadcast&echo ... ws4redis.js (line 18) Connected! ws4redis.js (line 46) Connection closed! ws4redis.js (line 57) Connecting to ws://127.0.0.1:3032/ws/hpo?subscribe-broadcast&publish-broadcast&echo ...
reading a little bit in the redis_store.py... i get a error in the nginx <-> uwsi_websocket.py communication (check the sniffing)..it says
'NoneType' object has no attribute 'encode'..
Does that have something to do with the heartbeat that maybe is not working here?
Can you see what happens at this line, during debug? https://github.com/jrief/django-websocket-redis/blob/master/ws4redis/wsgi_server.py#L54
When I had this problem, the server was not able to find the session_key.
@ezesolares I also had to set the heartbeat message: WS4REDIS_HEARTBEAT = '--heartbeat--'
Thanks for taking an interest in my case, im a lil lost
I added a couple of prints because i dont know how else to debug a wsgi app... i'm getting this on console.
request; <WSGIRequest: GET '/ws/hpo?subscribe-broadcast&publish-broadcast&echo'>
session_key: l7pr00c3oe65oywiwlqgbhz9fft3ob8v
settings.SESSION_COOKIE_NAME: sessionid
engine: <module 'django.contrib.sessions.backends.db' from '/home/rtas/webapp/webapp/lib/python3.4/site-packages/django/contrib/sessions/backends
/db.py'>
I'll add the heartbeat message and try
Well, adding the WS4REDIS_HEARTBEAT fixed the disconnect issue so far, im getting the heartbeat on my webapp every 3 seconds now... i'm not sure if this would work with more latency considering that i'm testing on the same machine now. I'll open it to the world and see how it works over a mobile connection... and if this fix it.
Its working like charm now.. i restarted the hardware today and all the changes i made thanks to this thread are working... its just ocnnected and no heartbeats all the time
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 _
uwsgi
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
wsgi_websocket <-> redis
and the communication between wsgi_websocket app and redis (in port 6379)
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