uvicorn启动fastapi使用websocket报错Unsupported upgrade request

Python

uvicorn启动fastapi使用websocket报错Unsupported upgrade request

年份
2021
分类
Python

原因:Uvicorn在新版本后[>= 0.12]有关,不会自动提供websocket实现。

解决:先卸载已有版本uvicorn:pip uninstall unicorn

重新安装指定版本pip install uvicorn [standard]

即可正常使用。