Take the 2-minute tour ×

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.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
add comment

Your Answer


