sec*_*rve 9 python tornado websocket
如何在Tornado上设置WSS(Secure WebSockets)?
在他们的文档中,他们说以下内容:
WebSocketHandler.get_websocket_scheme
可用于在未正确设置的情况下选择适当的URL方案(ws://
或wss://
) HTTPRequest.protocol
.
那么,我如何使用get_websocket_scheme
和/或HTTPRequest.protocol
让WSS在Tornado上工作.
sec*_*rve 13
我知道了 :))
只需将其添加到您的应用程序:
http_server = tornado.httpserver.HTTPServer(application,ssl_options={
"certfile": "cert.cer",
"keyfile": "key.key",
})
Run Code Online (Sandbox Code Playgroud)
这将解决问题.与常规HTTPS非常相似.我也很欣赏任何其他方式来使它工作.