I created a Consumer class with AsyncJsonWebsocketConsumer
and initialized a <groups> variable with an array ['test'];
such that "test" becomes one of the groups(or broadcast room)
In the following code
```
async def connect(self):
await self.channel_layer.group_add(
group='test',
channel=self.channel_name
)
print("THE CHANNEL NAME IS ------------> ", self.channel_name)
await self.accept()
```
My query is what exactly is self.channel_name and is it just a convention
and I should be bothered by it.
Because when I declare (following is the code for same) I don't pass any
channel_name
```
settings.CHANNEL_LAYERS = TEST_CHANNEL_LAYERS
communicator = WebsocketCommunicator(
application=application,
path='/sepsisDynamic/'
)
connected, _ = await communicator.connect()
message = {
'type': 'echo.message',
'data': 'This is a test message.',
}
channel_layer = get_channel_layer()
await channel_layer.group_send('test', message=message)
```
I believe it's built-in functionality but I am curious what exactly it does.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/240c0374-26e4-4e1a-b115-b1b80c5f3810n%40googlegroups.com.