Hi,

Documentation for Django 3.1 
<https://docs.djangoproject.com/en/3.1/topics/async/#async-views:%7E:text=The%20main%20benefits%20are%20the%20ability,long%2Dpolling%2C%20and%20other%20exciting%20response%20types.>
 says 
this about async views:

*The main benefits are the ability to service hundreds of connections 
without using Python threads. This allows you to use slow streaming, 
long-polling, and other exciting response types.*

I believe this means we could implement an SSE (Server-Sent Events 
<https://en.wikipedia.org/wiki/Server-sent_events>) view without 
monopolizing a thread per client, but I didn't figure out exactly how.

I know about Django Channels, but I'm curious to see if we can avoid it. 

I initially thought StreamingHttpResponse was the way to go since it has 
been used successfully to implement SSE with synchronous views 
<https://stackoverflow.com/a/55522953/1164966>. Still, I would accept any 
solution based on asynchronous views.

I opened a bounty on stack-overflow 
<https://stackoverflow.com/q/63316840/1164966>, but so far, no viable 
solution was proposed.  

Does anyone know how we could leverage async views to implement SSE?

Best regards,
Benoit Blanchon





-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/18e1e20f-c3a0-4a21-845e-bf6f30c452f8n%40googlegroups.com.

Reply via email to