When the connection comes in, you put them in a group based on the URL like this:
Group('chat-' + label).add(message.reply_channel)
Instead, if you want multiple rooms down one WebSocket, you need to add them to a group for all of the rooms that the connection should receive messages for. Either by stuffing multiple names in the URL, or by having commands sent down the socket and handled in the websocket.receive handler to add/remove from groups.
There's an example that shows some of this stuff here: https://github.com/andrewgodwin/channels-examples/tree/master/multichat
Andrew
On Wed, Apr 26, 2017 at 12:16 AM, Yarnball <yconomos@gmail.com> wrote:
Thanks Andrew. I deleted the other post. I'm do not quite follow.--I don't have a "user" key anywhere. And do I need to do a for loop to get the results? An example would be great.Cheers
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/70247961- .2d6f-49e4-bf30-e5c2975416d1% 40googlegroups.com
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/CAFwN1uqLkUq2jDysGXfVDE6-DfoPvchqTq%2Bokwban8Yxo%3DZ2Jg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment