Server-Sent Events with Nginx and uWSGI

2019-06-18 08:59发布

Is it possible to use server-sent events from a python/Flask application that is behind uWSGI and Nginx?

I've found packages that implement SSE in python/Flask, but they seem to all do so using gevent and greenlets.

https://github.com/DazWorrall/flask-sse

Thanks!

2条回答
对你真心纯属浪费
2楼-- · 2019-06-18 09:37

Recent versions of uWSGI (from 1.9) have built-in support for websockets / SSE. This article provides an excellent guide:

uWSGI docs: Offloading Websockets and Server-Sent Events

查看更多
太酷不给撩
3楼-- · 2019-06-18 09:41

can't you simply use gevent with uWSGI ?

Generally this kind of technologies should be used with async engines as the multithread/multiprocess paradigm would be too much costly.

查看更多
登录 后发表回答