> On Sat, May 30, 2015 at 4:19 PM, Florian Apolloner
> <[email protected]> wrote:
>> ie how would it use Django's current featureset which is basically
>> blocking
>> everywhere…
>
> On Sat, May 30, 2015 at 4:40 PM, Emil Stenström <[email protected]> wrote:
>> The separate process would have none of Django's features, it would just
>> be
>> a way to send messages to connected clients.
>
>
> take a look on how it's done with uWSGI: [1].  Basically, the http
> request arrives to a Django view in the normal way; then it generates
> a response with a custom header, which the uWSGI system recognizes
> (much like X-Sendfile), and routes the request to a gevent-based wsgi
> app that uses an sse package (probably [2]) to keep the connection.
>
> in the given example, there's no further communication between Django
> and the SSE process, but the author then comments it could be done
> either with the uWSGI caching framework, or via Redis.
>
> If I were to implement this today (and in fact, i have an application
> that might need this in the near future), i would use basically this
> scheme (as I'm using uWSGI for all my deployments), and Redis.  The
> SSE process would keep in Redis the current set of connected users,
> and the Django process would send messages via Redis to the SSE
> process.  Of course, not only 'broadcast' messages to every connected
> user, but user-specific messages too.
>
> I don't see how would i do it for a reusable app, since it looks most
> of the code would run 'outside' Django.  Doing it for the Django core
> seems even more problematic, since it would also have to be much more
> flexible in requirements, both for the WSGI container (does mod_wsgi
> support async python code?  i guess gunicorn does), and also for the
> communications between the 'main' Django views and the SSE part.
> (probably the cache API would be appropriate)
>
>

I obviously agree, but take in account that this uWSGI plugin simplified
the steps a lot:

https://github.com/unbit/uwsgi-sse-offload

-- 
Roberto De Ioris
http://unbit.com

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/f32688a1ec922e02ca91219c2d608412.squirrel%40manage.unbit.it.
For more options, visit https://groups.google.com/d/optout.

Reply via email to