Reputation: 5817
How to set WSS (Secure WebSockets) on Tornado?
In their docstring, they say the following:
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.
So, how can I use get_websocket_scheme
and/or HTTPRequest.protocol
to get the WSS to work on Tornado.
Upvotes: 9
Views: 3062
Reputation: 5817
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.
Upvotes: 13