How to set WSS (Secure WebSockets) on Tornado?
如何在Tornado上設置WSS(安全WebSockets) ?
In their docstring, they say the following:
在他們的docstring中,他們說:
WebSocketHandler.get_websocket_scheme
can be used to select the appropriate url scheme (ws://
or wss://
) in cases where HTTPRequest.protocol
is not set correctly.
WebSocketHandler。get_websocket_scheme可用於在HTTPRequest場合選擇適當的url模式(ws:/或wss:/)。協議設置不正確。
So, how can I use get_websocket_scheme
and/or HTTPRequest.protocol
to get the WSS to work on Tornado.
那么,如何使用get_websocket_scheme和/或HTTPRequest呢?讓WSS處理Tornado協議。
13
I got it :))
我明白了:))
Just add this to your application:
只需將此添加到您的應用程序中:
http_server = tornado.httpserver.HTTPServer(application,ssl_options={
"certfile": "cert.cer",
"keyfile": "key.key",
})
This will solve the problem. Just very similar to regular HTTPS. I also appreciate any other way to make it work.
這將解決問題。就像普通的HTTPS一樣。我也很欣賞其他的方法。
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2012/12/30/2521d26dbbe6c83b4a4efb0a666ab42f.html。