Flask, Python and Socket.io: multithreading app is giving me “RuntimeError: working outside of request context”

后端 未结 2 1195
半阙折子戏
半阙折子戏 2021-02-19 09:33

I have been developing an app using Flask, Python and Flask-Socket.io library. The problem I have is that the following code w

2条回答
  •  失恋的感觉
    2021-02-19 09:43

    You are using the wrong emit here. You have to use the emit of the socketio object you created. so instead of

    emit('anEvent', jsondata, namespace='/test') # here occurs the error use: socketio.emit('anEvent', jsondata, namespace='/test') # here occurs the error

提交回复
热议问题