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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Arean Bbay
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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: 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

aishtiaque
If my Channels 2 knowledge serves me right, your group names for these two consumers should be unique. The group names should determine which consumer's assignQuiz method is executed. 

Hope this helps!

On Wed, Jun 12, 2019 at 9:25 PM Arean Bbay <[hidden email]> wrote:
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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAKizqR5e6T-dYdpYeJGXOKd-dPmOAFKgsBW4PonDJ2HJfA2ufQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 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

Arean Bbay
Only the StudentConsumer has assignQuiz, the InstructorConsumer doesn't have.
So, you were saying so long as the method is invoked on the group that the StudentConsumer belongs to, there should be no problem?



On Wednesday, June 12, 2019 at 8:43:35 PM UTC-7, Ahmed Ishtiaque wrote:
If my Channels 2 knowledge serves me right, your group names for these two consumers should be unique. The group names should determine which consumer's assignQuiz method is executed. 

Hope this helps!

On Wed, Jun 12, 2019 at 9:25 PM Arean Bbay <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="SVscdE00BgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">area...@...> wrote:
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="SVscdE00BgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="SVscdE00BgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django...@....
Visit this group at <a href="https://groups.google.com/group/django-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/293849f4-eb39-468f-a3fd-961d19e1dad2%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/293849f4-eb39-468f-a3fd-961d19e1dad2%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/293849f4-eb39-468f-a3fd-961d19e1dad2%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/293849f4-eb39-468f-a3fd-961d19e1dad2%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/a3cd6d78-57c9-42ae-a907-78b9220cfb44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.