Messages to channels doesn't come after some channels in group
See original GitHub issueI have a problem with message delivery to groups that have many channels in it.
I noticed that after I have many channels in a group – this channels stop receive messages posted to that group.
Here is my consumer class:
class NotificationConsumer(WebsocketConsumer):
def connect(self):
user = self.scope['user']
if user.is_authenticated:
async_to_sync(self.channel_layer.group_add)('auth', self.channel_name)
async_to_sync(self.channel_layer.group_add)(user.channels_group_name, self.channel_name)
else:
async_to_sync(self.channel_layer.group_add)('noauth', self.channel_name)
self.accept()
def disconnect(self, close_code):
user = self.scope['user']
if user.is_authenticated:
async_to_sync(self.channel_layer.group_discard)('user_%s' % user.id, self.channel_name)
async_to_sync(self.channel_layer.group_discard)('auth', self.channel_name)
else:
async_to_sync(self.channel_layer.group_discard)('noauth', self.channel_name)
def message(self, event):
message = event['message']
self.send(text_data=json.dumps({'type': 'message', 'object': message}))
def comment(self, event):
comment = event['comment']
status = event['status']
self.send(text_data=json.dumps({
'type': 'comment',
'object': comment,
'status': status,
}))
Here is how I send a messages to the groups:
async_to_sync(channel_layer.group_send)('user_123', {'type': 'message', 'message': message_data})
async_to_sync(channel_layer.group_send)('auth', {'type': 'comment', 'comment': data, 'status': status})
Consumers, connected to the small personal user’s groups (called ‘user_[id]’) receiving messages is ok, while new connected consumers to the groups ‘auth’ and ‘noauth’ don’t receiving messages after some channels in the group (~200-300+ channels in the group I guess).
We use: channels==2.1.2, channels-redis==2.2.1, daphne==2.2.0, Django==2.0.6, Twisted==18.4.0
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': { "hosts": ["redis://127.0.0.1:6379/6"]},
},
}
Channels run with daphne and Nginx in front.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Post a message to multiple channels - Microsoft Support
Select Post in multiple channels > Select channels. Choose which channels to post your message in. You can share wherever you're a member....
Read more >Django channels Group send dies after sending a certain ...
This message will not display after a certain number of sends. I am doing some updating behavior where this send will occur every...
Read more >React SDK does not show new group channels - JavaScript
For Sendbird, a channel with admin messages will be empty. Toni_U September 15, 2021, 11: ...
Read more >Notify a channel or workspace - Slack
In channels with at least six members, Slack will ask you to confirm before you send a message with any of these mentions....
Read more >How to Control Sending Email to Teams Channels
By default, any channel in a team can receive email from any sender. ... If you want the message to arrive in multiple...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In general I wouldn’t recommend Channels groups for any sort of large-scale work - you should probably roll your own solution if you have more than about 50 concurrent users in any single group, as you’ll know the best option to use at your scale.
Sorry we can’t make something that works better out of the box, but it would be a significant project to make them scale well to large group sizes and I don’t have a real-life deployment of that I can test on. Groups is more designed to have hundreds of groups with only a few members in each (i.e. per-user).
Andrew
On Mon, Aug 6, 2018 at 11:02 AM Dmitry notifications@github.com wrote:
Closing as this isn’t an actionable issue any more (see http://channels.readthedocs.io/en/latest/support.html)