> On 11 May 2015 at 21:01, Mikko Ohtamaa <[email protected]> wrote:
>
>>
>> Especially the b) part is still open question what comes to mixing in
>> traditional WSGI with websockets.
>>
>
> So this is how it goes.
>
> * uwsgi.websocket_handshake() sends downstream HTTP 101 Switch Protocols
> response and you can call this inside your view
>
> * After that you can take over the current uWSGI process/thread as a
> websocket event loop
>
> * You need combine uwsgi.websocket_recv_nb() with any other event you
> might
> be running
>
> * There is still some crude parts like getting "Response headers already
> send" error now and then when the message loop terminates, but here is the
> full answer:
>
> http://stackoverflow.com/a/30198253/315168


Here you will find an example usage for 'disableheaders' routing action:

http://uwsgi-docs.readthedocs.org/en/latest/articles/OffloadingWebsocketsAndSSE.html

that should solve your issue with duplicated headers

By the way your need is pretty common (the vast majority of apps out there
are synchronous, and they cannot be magically or easily moved to async)
and the next objective is to continue working on this direction:

https://github.com/unbit/uwsgi-realtime

that already lead to this plugin

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

the next one should be a uwsgi-websockets-offload (always using redis/disque)


-- 
Roberto De Ioris
http://unbit.com
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to