def send_stream():
conn = ConnectionPool.get_connection()
channel = getattr(session, 'sid', None)
if channel is None:
channel = 'common'
last_id = request.headers.get('Last-Event-Id')
if last_id is None:
last_id = request.args.get('lastid')
return current_app.response_class(
EvtStream(conn, channel, last_id),
direct_passthrough=True,
mimetype='text/event-stream')
评论列表
文章目录