flask-uwsgi-websocket
flask-uwsgi-websocket copied to clipboard
Do something before uwsgi starts handshaking
It would be nice if I could do something with the incoming HTTP request, before the actual uwsgi handshake is done (in https://github.com/zeekay/flask-uwsgi-websocket/blob/master/flask_uwsgi_websocket/websocket.py#L57).
This way I can include authentication HTTP headers and re-use the authentication system that I have set up for my REST API in my websocket connections. I would like to be able to do this before the handshake is done, so that I can deny the entire request before anything websocket-y is set up.
I'm not sure I understand what you'd like to see added. Is there a reason why you can't use middleware to accomplish this?
I've never written middleware, could you maybe point me to some examples on how that would work?