Flask-SocketIO: WebSocket is not available, what this mean ?

I have issue with message bellow:

WARNING in __init__: Flask-SocketIO is Running under Werkzeug, WebSocket is not available.

Every running my server, always showing error. Need help

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

As I said above, reconfigure your vsproject to run the script instead of calling flask run. Then add the following at the bottom of the script:

if __name__ == '__main__':
    socketio.run(app)

Yes. I added a run.py outside the flask app. And I use socketio.run(app) inside the file.

When I want to debug the flask app running on eventlet, I just added codes below to the launch.json:

    {
      "name": "Debug Flask",
      "type": "python",
      "request": "launch",
      "console": "integratedTerminal",
      "pythonPath": "${config:python.pythonPath}",
      "program": "path_to_run.py",
      "gevent": true,
      "cwd": "${workspaceFolder}",
      "args": []
    }

Everything works well.

@prakasa1904 @desmondddd I am having the same issue. Is there an example repo or a little bit more guidance on running socket.io outside of the flask app?

@desmondddd this is correct. The flask run command cannot be used to run on the more advanced webservers anymore. This command was broken and caused problems for some people, so I’m not supporting that way of starting the server anymore, except when using the Flask dev server, which does not have WebSocket. Use socketio.run(app) to run your eventlet or gevent web server.