How to handle websocket disconnect from client #2543
Unanswered
MichalPham
asked this question in
Q&A
Replies: 2 comments
-
Hi, |
Beta Was this translation helpful? Give feedback.
0 replies
-
We seem to be affected by the same issue. There seems to be a little of a disconnect between message types used for connection termination, or am I confused? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When disconectiong from client side (httpx-ws, js) using their respective
close
methods, thestartlette.websocket.receive_(text|bytes)
fails withRuntimeError
and not withWebSocketDisconnect
. Its caused by this line because the message type iswebsocket.close
and notwebsocket.disconnect
. I have not found a way how to sendwebsocket.disconnect
looking at the implementation of starlette close method it also sendswebsocket.close
.So the question really is how do i correctly disconect from client side.
Beta Was this translation helpful? Give feedback.
All reactions