问题描述 运行Sanic WebSocket服务器,出现如题错误。 解决方案 原因是在app.websockt('/')下的async def内又一次调用了loop=asyncio.get_event_loop(). 而Sanic的app.run()其实内部已经起了一个event_loop. 将async def内的loop=asyncio.get_event_loop()取消,改用await关键字将所需要执行的coroutine calls添加到已启动的event loop中就可以了。