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 messages(e.g. "ws://192.121.1.213:8080?function=myfunction?args=params..").Now, I want to use secure web socket i.e. wss in stead of ws. What changes are required on server and client side? Pointer to any online example would be also helpful. Thanks.
Asked
Active
Viewed 6,361 times
1 Answers
4
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

Ben Darnell
- 21,844
- 3
- 29
- 50
-
1Thanks for the reply! I made the changes to on server side as given in the example. Also, I changed the query to "wss://192.121.1.213:8080?function=myfunction?args=params.." (wss instead of ws). But it seems that this simple doesn't connect to server. How should I frame the query? – gaj Oct 07 '15 at 04:55
-
Hard to say without more detail, but my guess is that you're using a self-signed certificate and need to accept it in the browser first: http://stackoverflow.com/questions/24949576/wss-tornado-connection-issues – Ben Darnell Oct 07 '15 at 12:44