Re: channels v2.0.0 disconnect function not triggering

2018-02-06 Thread Andrew Godwin
You are not using it incorrectly - this is a known issue:
https://github.com/django/daphne/issues/152

Andrew

On Mon, Feb 5, 2018 at 11:53 PM, Ahmed Magdy  wrote:

> It seems like I cannot get the disconnect function in the consumer to get
> called at all.
>
> class ChatConsumer(WebsocketConsumer):
>def connect(self):
>self.accept()
>
> def disconnect(self):
>print('disconnected')
>
> Using self.close from the consumer, or closing the javascript websocket
> doesn't trigger the print at all, though it does write in the log that the
> websocket disconnected.
>
> [2018/02/06 09:50:32] WebSocket HANDSHAKING /sessions/ [127.0.0.1:7854]
> [2018/02/06 09:50:32] WebSocket CONNECT /sessions/ [127.0.0.1:7854]
> [2018/02/06 09:50:39] WebSocket DISCONNECT /sessions/ [127.0.0.1:7854]
>
> Am I using it incorrectly?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/520a3775-4a2b-4f9d-959f-bbe13491f6ab%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwN1upr3hO106DMDPCvZLTfjocA5WB%2BuWyFd8MT43WgsiBJ7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


channels v2.0.0 disconnect function not triggering

2018-02-05 Thread Ahmed Magdy
It seems like I cannot get the disconnect function in the consumer to get 
called at all.

class ChatConsumer(WebsocketConsumer):
   def connect(self):
   self.accept()

def disconnect(self):
   print('disconnected')

Using self.close from the consumer, or closing the javascript websocket 
doesn't trigger the print at all, though it does write in the log that the 
websocket disconnected.

[2018/02/06 09:50:32] WebSocket HANDSHAKING /sessions/ [127.0.0.1:7854]
[2018/02/06 09:50:32] WebSocket CONNECT /sessions/ [127.0.0.1:7854]
[2018/02/06 09:50:39] WebSocket DISCONNECT /sessions/ [127.0.0.1:7854]

Am I using it incorrectly?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/520a3775-4a2b-4f9d-959f-bbe13491f6ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.