How to use secure websocket (wss) in Tornado

后端 未结 1 1647
萌比男神i
萌比男神i 2021-02-11 07:17

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:01

    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)
提交回复
热议问题