How to use secure websocket (wss) in Tornado

后端 未结 1 1686
有刺的猬
有刺的猬 2021-02-11 07:56

I\'m new to Tornado and web services in general. In my application, I\'ve Qt/c++ client and python Tornado on server side. The Qt client sends commands in the form of text messa

1条回答
  •  独厮守ぢ
    2021-02-11 08:22

    Pass the ssl_options argument when constructing your HTTPServer:

    ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
    ssl_ctx.load_cert_chain(os.path.join(data_dir, "mydomain.crt"),
                            os.path.join(data_dir, "mydomain.key"))
    HTTPServer(applicaton, ssl_options=ssl_ctx)
    

    http://www.tornadoweb.org/en/stable/httpserver.html#http-server

    0 讨论(0)
提交回复
热议问题