FastAPI WebSocket

此篇文章参考:https://www.cnblogs.com/CharmCode/p/13552551.html

首先安装 websockets , 别上来就按照文章一段操作如猛虎,回头一看二百舞
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
fastAPI 中的WebSocket也是基于websockets运行的

不安装websockets

  • 前端报错:failed: Error during WebSocket handshake: Unexpected response code: 400
  • 后端报错:WARNING: Unsupported upgrade request
pip3 install websockets
©️2020 CSDN 皮肤主题: 书香水墨 设计师:CSDN官方博客 返回首页