[英]Flask-socketio emit in route
我无法在路线中发射。 我想在调用 function 时发出,但它给出了错误。
像这样`
@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"
使用 flask-socketio 中的namespace
在路由中发出。
@socketio.on('my event', namespace='/hello')
def hello():
emit('my response', {'data': 'got it!'})
return "11"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.