About the use of tornado websocket

the current situation is that port 7999 of tornado is running two app, and one http protocol and one websocket protocol, all of which are normal on localhost, but on the server, websocket cannot shake hands successfully. Do you have any relevant experience in timeout, directly?

Front end code:

    //weosocket
    initWebSocket(){
      if(this.websocket === null || this.websocket === undefined){
        const config = require("../../../config");
        const endpoint = location.hostname + ":" + config.dev.endport;
        const wsuri = "ws://"+ endpoint + "/connect"
        this.websocket = new WebSocket(wsuri);
        this.websocket.onopen = this.websocketonopen;
        this.websocket.onerror = this.websocketonerror;
        this.websocket.onmessage = this.websocketonmessage;
        this.websocket.onclose = this.websocketclose;
      }
 },
    websocketonopen() {
      console.log("WebSocket");
 },

backend code:

if __name__ == "__main__":
    tornado.options.define("port", default=7999, help="run on the given port", type=int)
    tornado.options.parse_command_line(sys.argv)

    flask_wsgi_app = tornado.wsgi.WSGIContainer(app)

    mixed_app = tornado.web.Application([
        ("/connect", ConnectionHandler),
        (".*", tornado.web.FallbackHandler, dict(fallback=flask_wsgi_app))
    ])

    http_server = tornado.httpserver.HTTPServer(mixed_app)
    http_server.listen(tornado.options.options.port)
    tornado.ioloop.IOLoop.instance().start()
Nov.25,2021

"server" environment, the connection may not be directly to your tornado, there may be other devices ahead, these devices may not necessarily support websocket.
Let's confirm the environmental problems first.


if you use forwarding tools such as nginx , they are likely to be specially configured.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b352c7-2b7c5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b352c7-2b7c5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?