Django Channels - Delay server for Group messages

102 views
Skip to first unread message

Adrián Cuesta

unread,
Mar 6, 2017, 8:23:21 PM3/6/17
to Django users
Hi

Is there any way to send delayed messages to Group instead of a Channel?

The delay server example here gives this example:

from channels import Channel

delayed_message = {
   
'channel': 'example_channel',
   
'content': {'x': 1},
   
'delay': 10 * 1000
}
# The message will be delayed 10 seconds by the server and then sent
Channel('asgi.delay').send(delayed_message, immediately=True)

I would like to use the same but with Group, this way:


from
channels import Group

delayed_message = {
   
'channel': 'example_channel',
   
'content': {'x': 1},
   
'delay': 10 * 1000
}
# The message will be delayed 10 seconds by the server and then sent
Group('asgi.delay').send(delayed_message, immediately=True)


Can someone give some feedback about this?

Thanks,

Adrián

Andrew Godwin

unread,
Mar 7, 2017, 3:44:37 AM3/7/17
to django...@googlegroups.com
Not at the moment, the delay server is not built with that in mind. It could be extended to do so if you wanted to look into it.

Andrew

--
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...@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/ce74c6c7-18b4-4b7e-83fe-e2cc4f6bbd1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages