I'm relatively new to channels and was using Channels v1.x.x groups easily, but after v2.0.0 update and reading the documentation
channel_layer, channel_name are always NoneType and exception occurs.
Is that because I didn't configure channel layers? But in the old version I also used the in memory type and Groups were working well.
-- # This example uses WebSocket consumer, which is synchronous, and so
# needs the async channel layer functions to be converted.
from asgiref.sync import AsyncToSync
class ChatConsumer(WebsocketConsumer):
def connect(self):
AsyncToSync(self.channel_layer.group_add)("chat", self.channel_name)
def disconnect(self):
AsyncToSync(self.channel_layer.group_discard)("chat", self.channel_name)
Enter code here...
channel_layer, channel_name are always NoneType and exception occurs.
Is that because I didn't configure channel layers? But in the old version I also used the in memory type and Groups were working well.
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+unsubscribe@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/fff84d59-da69-47d5-a7c3-ee0221680642%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment