L
L
LakeForest2021-09-09 20:37:54
Tornado
LakeForest, 2021-09-09 20:37:54

How to make wss connection support?

WebSocket connection to ' wss://localhost:8000/ws ' failed:
Everything is fine as long as the project was local, after posting an error about the secure protocol. I don't understand what needs to be done to make it work?
Tried what is commented out - same error.

import os
from models.ws_handler import WsHandler
from consumer import ServerConsumer
import tornado.ioloop
import ssl

if __name__ == '__main__':
    consumer = ServerConsumer()
    consumer.start_start_consuming_thread()

    application = tornado.web.Application(handlers=[
        (r'/ws', WsHandler)
    ], default_host="0.0.0.0")

    port = int(os.environ["PORT"])
    ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
    ssl_ctx.load_cert_chain(os.path.join(os.path.abspath('.'), "private", "cert.pem"),
                            os.path.join(os.path.abspath('.'), "private", "key.pem"))
    ssl_ctx.load_verify_locations(os.path.join(os.path.abspath('.'), "private", "key.pem"))

    http_server = tornado.httpserver.HTTPServer(application, ssl_options=ssl_ctx)
    http_server.listen(port=port)
    #application.listen(port=port)

    tornado.ioloop.IOLoop.instance().start()


tornado.general;SSL Error on 13 ('xxxx', yyyy): [SSL: HTTP_REQUEST] http request (_ssl.c:1131)

The application is in a separate docker container.
I guess it makes no sense to change the port inside the container to 443 ... Moreover, it seems to be busy for the frontend (user entry point)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2021-09-09
@LakeForest

The domain name is not correct, not what is specified in the certificate.

Similar questions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question