Replies: 1 comment 4 replies
-
I'm not sure if I get what you said. Can you provide the interaction between the client and server, and when you expect an exception? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can the server detect a situation when the client didn't receive a message sent by the server,
specifically when the client disconnected not gracefully (=without closing the websocket explicitly)?
To my understanding, this should have raised an exception, but it doesn't.
The first time when Starlette notices that anything is wrong, is when the ping interval times out.
To easily see that, run the following server:
and run it with a higher ping interval:
import uvicorn uvicorn.run('app:app',host='0.0.0.0', port=5000,ws_ping_interval=300, ws_ping_timeout=300)
For the client, use a mobile phone, and put the phone in airplane mode while it is connected to the server.
Call the server via the endpoint /websockets/send_message/<user_id>.
The server will happily describe all of the messages as "sent" for 5 minutes.
If this behavior is expected (to my understanding exception should have been raised), how can I check if the message was actually received by the client?
Beta Was this translation helpful? Give feedback.
All reactions