postgresql2websocket.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:postgresql2websocket 作者: frafra 项目源码 文件源码
def websocket_handler(request):
    channel = request.match_info.get('channel', 'postgresql2websocket')
    ws = web.WebSocketResponse()
    await ws.prepare(request)
    request.app['websockets'].append(ws)
    pool = request.app['pool']
    async with pool.acquire() as connection:
        queue = asyncio.Queue()
        await connection.add_listener(channel, callback_websocket(ws))
        try:
            async for msg in ws:
                pass
        finally:
            request.app['websockets'].remove(ws)
    return ws
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号