上证所
服务器发送事件的简单 asyncio/aiohttp 包装器。
用法
发送事件:
import asyncio
import sse
class Handler ( sse . Handler ):
@ asyncio . coroutine
def handle_request ( self ):
yield from asyncio . sleep ( 2 )
self . send ( 'foo' )
yield from asyncio . sleep ( 2 )
self . send ( 'bar' , event = 'wakeup' )
start_server = sse . serve ( Handler , 'localhost' , 8888 )
asyncio . get_
评论0
最新资源