Wednesday, June 12, 2019

Django channel 2: do I have to prefix value of 'type' (the listening consumer method) of group_send with consumer class name if the consumer is a different one

I have 2 consumers, namely StudentConsumer and InstructorConsumer.So if the url is:
ws://quizz_poll//student, it will be routed to the former.
otherwise ws://quizz_poll//instructor, then it will be routed to the latter.

Within studentConsumer is a assignQuizzz(...) method. What I want to do is to  invoke that assignQuizz of student from instructor consumer using group_send.
The problem is I don't know how. Say if I only have one consumer, then I could do from the InstructorCousumer

self.channel_layer.group_send(group_name,
                {
                    "type": "assignQuizz",
                    "message": message,
               }

In my case do I just use "type" : "StudentConsumer.assignQuizz" ?

--
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/293849f4-eb39-468f-a3fd-961d19e1dad2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment