'socket.io-client websocket connection issue to flask server

Flask-SocketIO==4.3.2 socket.io-client: ^4.4.1 Hello I am running a websocket server using flask.

from flask_socketio import SocketIO
from flask import Flask

app = Flask(__name__)
socketio = SocketIO(app, logger=True, engineio_logger=True)
socketio.init_app(app, cors_allowed_origins="*")


@app.route("/")
def hello_world():
    return "<p>Hello, World!</p>"


@socketio.on("connect")
def handle_connection(data):
    """Start recording audio from the client."""
    print("A new connection was created")


@socketio.on("disconnect")
def test_disconnect():
    print("Client disconnected")


if __name__ == "__main__":
    socketio.run(app, debug=True)

And I am trying to interact with it from a react native app build on my iphone

  const manager = new Manager('http://127.0.0.1:5000', {
    autoConnect: false,
    transports: ['websocket'],
  });
  manager.open(err => {
    if (err) {
      console.log(err);
    } else {
      console.log('Connection was successfull');
    }
  });

But every time it try to create a connection, a [Error: websocket error]error message is sendback. I am looking for more verbosity or a solution.

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source