On Thu, Jun 8, 2017 at 8:55 PM, Tom Christie <christie....@gmail.com> wrote:

> > Any interface like this would literally just be "this function gets
> called with every event, but you can't listen for events on your own"
>
> Gotcha, yes. Although that wouldn't be the case with asyncio frameworks,
> since the channel reader would be a coroutine.
> Which makes for interesting design thinking if you want to provide an
> consumer interface that's suitable for both framework styles.
>

Well, it would be the case, it's just that it will launch a new coroutine
for each message, the way I'm thinking. It's either that or just one
coroutine context that processes messages linearly, and then you launch
lots of those in parallel.


>
> > HTTP request bodies being not an event, but a stream, and they're fine
> as they are deliberately on a special channel per request.
>
> Which it turns out actually makes the cooperative-tasks in a
> single-process implementation slightly awkward. (Doable, but rather more
> complex)
> For the purposes of my implementation it makes sense that if you've got a
> synchronous HTTP callable, then the server should buffer the incoming data
> and only dispatch a single message. (Not a problem wrt. Django, since
> ASGIHandler ends up effectively doing that in any case.)
>
>
Right, and this is the ultimate tradeoff I had to make in ASGI - the
WebSocket design problem means you simply cannot design around having
things all work in a single coroutine unless you go all the way and
guarantee that things are _always_ in the same thread so you don't need to
do sticky routing.

Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFwN1uriNN4zxrXyN-fTYgTWX%2BeTE%3D2TPcKS-kqqwvL%3DpfzaWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to