Flask-socketio crash and I dont know why

Viewed 21

I have this funcion

@socketio.on('Generate')
def Generate(msg):

and the server runs like this:

app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'

socketio = SocketIO(app=app,cors_allowed_origins="*")

cors = CORS(app)
socketio.run(app,port=5100,debug=True,allow_unsafe_werkzeug=True)

and over the Generate function there is emit calls

and on the client side its look like this: var Mysock = io(pythonUrl);

useEffect(() =>
    {       
        Mysock.on('Generate', () => 
        {
            console.log('Generate');
        }) 
        return () => 
        {
            Mysock.off('Generate');
        };
    },[])

after a while I am getting this errors: enter image description here

I read that it might be because of the synchronization of the function, but I don't understand why it should have an effect

Thank you :)

0 Answers
Related