让我们说资源看起来像这样:
class MessageSender(Resource):
@jwt_required
def post(self, conversation_id):
emit('newMessage', conversation_id, broadcast=True)
return {'message': "Messaged has been sent"},201
它将返回AttributeError:'Request'对象没有属性'namespace'
在主文件中:
api = Api(app)
socketio = SocketIO(app,cors_allowed_origins='*')
如何从资源文件中的同一socketIO对象发出事件? 谢谢