I want to serve a real-time stream that has to be securely encrypted due to sensitive data.
I\'ve successfully got normal WebSockets streaming using both gevent and guni
Take a look at the standalone websockets server of the pywebsocket project supported by Google.
Note that this Python module uses CGIHTTPServer
so you need to tweak it to make it secure. I had a similar requirement for a project I was involved in some months ago, so I forked the standalone.py module and removed the dependencies with CGI stuff but I haven't tested secure connections very much.
Maybe you can import OpenSSL.SSL
and set up a WebSocketServer
as it is in my script. It should use a WebSocketRequestHandler
with the proper configuration of use_tls
, private_key
and certificate
in order to implement TLS (Transport Layer Security).
Read the source code. I think you can extend it to meet your needs.