Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscribe to User Notification does not work #267

Open
jotauses opened this issue Jun 14, 2018 · 4 comments
Open

Subscribe to User Notification does not work #267

jotauses opened this issue Jun 14, 2018 · 4 comments

Comments

@jotauses
Copy link

jotauses commented Jun 14, 2018

Simply http://django-websocket-redis.readthedocs.io/en/latest/usage.html does not work. Copied and paste from the docs and only works the broadcast message.

https://stackoverflow.com/questions/50862982/django-websockets-with-redis

@2DKot
Copy link

2DKot commented Jun 19, 2018

Is your user logged in?
Try session notification http://django-websocket-redis.readthedocs.io/en/latest/usage.html#subscribe-to-session-notification - does it work?

@jotauses
Copy link
Author

Yes, the user is logged in.
No, It does not work with sessions neither, only works the broadcast.

@2DKot
Copy link

2DKot commented Jun 26, 2018

Try to debug authorization during socket connection.
Place breakpoint to

request.session = None
and refresh page. Is request.user successfully assigned here?

@jotauses
Copy link
Author

jotauses commented Jun 26, 2018

No, the request.user is a AnonymousUser and I'm logged in...
Just as it says in the documentation I'm using django-redis-session but the sessionid tokens are differents between views.py and wsgi_server.py

If I get the sessionid from the views.py's request and I put it in the var session_key of the line 65 of wsgi-server.py works perfectly, so... the problem is that the sessionid tokens are differents... how can I solve that?

I reset the cookies and cache and now the cookie is always null in the wsgi_server.py because a error. The trace is:

Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 775, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] Se ha anulado una conexión establecida por el software en su equipo host
[27/Jun/2018 08:48:05] "GET /ws/foobar?subscribe-user/ HTTP/1.1" 500 59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants