我不能在路线上发射。我想在调用函数时发出,但是它给出了错误。
赞!
@app.route('/')
def index():
return render_template('index.html')
@socketio.on('my event')
@app.route('/hello', methods=['POST', 'GET'])
def hello():
emit('my response', {'data': 'got it!'})
return "11"
答案 0 :(得分:0)
在flask-socketio中使用namespace
进行发射。
@socketio.on('my event', namespace='/hello')
def hello():
emit('my response', {'data': 'got it!'})
return "11"