call websocket close in channel close
This commit is contained in:
parent
2afd5c202c
commit
0bc18ea33c
@ -71,6 +71,7 @@ class WebSocketChannel:
|
||||
Close the WebSocketChannel
|
||||
"""
|
||||
|
||||
await self._websocket.close()
|
||||
self._closed = True
|
||||
|
||||
def is_closed(self) -> bool:
|
||||
|
@ -56,8 +56,10 @@ class WebSocketProxy:
|
||||
Close the websocket connection, only supported by FastAPI WebSockets
|
||||
"""
|
||||
if hasattr(self._websocket, "close"):
|
||||
return await self._websocket.close(code)
|
||||
pass
|
||||
try:
|
||||
return await self._websocket.close(code)
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
async def accept(self):
|
||||
"""
|
||||
@ -65,4 +67,3 @@ class WebSocketProxy:
|
||||
"""
|
||||
if hasattr(self._websocket, "accept"):
|
||||
return await self._websocket.accept()
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user