【发布时间】:2015-04-09 18:46:14
【问题描述】:
我正在尝试在用户的 id 命名空间上监听新的 socketIO 连接。用户 ID 存储在烧瓶会话对象中。
@socketio.on('connect', namespace=session['userId'])
def test_connect():
emit('newMessage')
此代码产生以下错误:
raise RuntimeError('working outside of request context')
如何让上述连接监听器在请求上下文中运行?
谢谢!
【问题讨论】:
标签: python flask socket.io gevent-socketio flask-socketio