🐛 Fix: aiohttp 驱动未处理 WSMsgType.CLOSED 类型 (#3862)

This commit is contained in:
呵呵です
2026-02-14 19:29:11 +08:00
committed by GitHub
parent 7fbab3de79
commit 346eddda06
2 changed files with 43 additions and 1 deletions

View File

@@ -323,7 +323,11 @@ class WebSocket(BaseWebSocket):
async def _receive(self) -> aiohttp.WSMessage:
msg = await self.websocket.receive()
if msg.type in (aiohttp.WSMsgType.CLOSE, aiohttp.WSMsgType.CLOSING):
if msg.type in (
aiohttp.WSMsgType.CLOSE,
aiohttp.WSMsgType.CLOSING,
aiohttp.WSMsgType.CLOSED,
):
raise WebSocketClosed(self.websocket.close_code or 1006)
return msg