Closed arjunmenon closed 6 years ago
This is duplicate of this: https://github.com/Pithikos/python-websocket-server/issues/35
I haven't dug much into it but I assume the main change would be replacing the HttpServer with an HttpsServer (if that exists).
class WebsocketServerSSL(WebsocketServer):
def __init__(self, port, host='127.0.0.1', loglevel=logging.INFO):
WebsocketServer.__init__(self, port, host, loglevel)
self.context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
self.context.load_cert_chain(cert_, privkey_)
self.socket = self.context.wrap_socket(self.socket, server_side=True)
This works for me without any modifications to the lib
class WebsocketServerSSL(WebsocketServer): def __init__(self, port, host='127.0.0.1', loglevel=logging.INFO): WebsocketServer.__init__(self, port, host, loglevel) self.context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) self.context.load_cert_chain(cert_, privkey_) self.socket = self.context.wrap_socket(self.socket, server_side=True)
This works for me without any modifications to the lib
Does that mean you have achieved it?
Hey I understand this lib at the moment doesn't support SSL but if we have to add the secure websocket, what can we do?