-
-
Notifications
You must be signed in to change notification settings - Fork 824
Closed
Description
Hello! Its are little bug report. If you have 2 django apps with diffrent consumers but on same url base, like that:
main
> settings.py
> etc..
app_1
> consumer.py
> channels_urls.py
app_2
> consumers.py
And if in channel layers we have same keywords, like "message", for both consumers,
socket will not work. So its pretty unexpactable because its have diffrenct consumers. Solution its just rename same keywords.
It will be pretty good if we have some info about it in documentation, because i spent a lot of hours on that problem :)
Here is example what will work
app_2
async_to_sync(self.channel_layer.group_send)(
f"user_chat{chat_room}",
{
'type': 'message_user',
'chat_message': message,
'chat_username': self.scope['user'].username,
}
)
app_1
async_to_sync(self.channel_layer.group_send)(
"chat",
{
'type': 'message_all',
'message': text_data,
'username': self.scope['user'].username,
}
)
and what will not work:
app_2
async_to_sync(self.channel_layer.group_send)(
f"user_chat{chat_room}",
{
'type': 'message_user',
'chat_message': message,
'chat_username': self.scope['user'].username,
}
)
app_1
async_to_sync(self.channel_layer.group_send)(
f"user_chat{chat_room}",
{
'type': 'message_user',
'chat_message': message,
'chat_username': self.scope['user'].username,
}
)
app_1 will work, app_2 is not :) pretty strange i guess,
Also thank for all contributors for this great tool!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels