On Wed, Oct 11, 2017 at 3:02 AM, 'matrix1900' via Django users <
django-users@googlegroups.com> wrote:

> Hi together,
>
> I try to get started with Django Channels.  I have actually two questions:
>
> 1. I use web sockets with channels. I want to have for each frontend user
> which opens the website his own websocket channel without groups. I am not
> sure how does it works when several Users opens the website ? Has each
> frontend user his own consumer thread which handles the web socket messages
> ? How are the concept here?
>

The server holds on to all the websockets in one big async thread, then
calls your Django code synchronously whenever an event happens on the
socket.


>
> 2. How can I receive websocket messages in a separate task. I found in the
> FAQ on the Channels Site the hint to use *receive_many()* but I'm not
> sure how to use it exactly.
>

You shouldn't do this, use the normal worker pattern, there's lot more than
just receive_many to do


>
> 3. How can I start a separate task  in the consumer.py after receive a
> message ('websocket.receive')
> ( for example: In Consumer I get a message via websocket from the frontend
> user, according to the message I start a process with some arguments, after
> execute the process,  I get the results back and send it to the individual
>  websocket channel client)
>


You have to send it to a custom channel with the reply_channel of the
socket, have a worker listen on that channel, and when it is done send
information back to the reply_channel.

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+unsubscr...@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/CAFwN1uqiCoduLg8G9T4AHnc4N26chwjcRw5wiCB0dXVdFiTuBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to