Hello everyone! I'm new in Django Channels. I'm using Channels 2.0 and I have few questions about it. I'm using JsonWebsocketConsumer class for my consumer and I wrote my definition of connect method like this:
def connect(self): user = self.scope.get('user') if user.is_anonymous: super(NotificationsConsumer, self).connect() else: self.close(code=4003) On client side I'm using native JS Websocket. But when I try to connect to this socket as unauthorzied user I get code 1006 and HTTP response status code 403. My questions is: 1) How can I send custom close code to client? 2) Can I send another HTTP response status code? In my case 401 -- 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/446d3be6-438b-4e59-ad4f-7841895f4fcb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.