In the HTTP protocol, the 'Connection: keep-alive' is ineffective #2833
-
I requested a WebSocket and HTTP in the frontend, both sharing port 8000. I want HTTP to use a persistent connection for image transmission. However, even though I used 'Connection: keep-alive', the TCP connection still disconnects and establishes a new connection (observed through TCP port numbers). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I don't know what you are doing. |
Beta Was this translation helpful? Give feedback.
-
@AlexOct YSK that modern web browsers will timeout websocket connections that sit idle. The solution is to implement a heartbeat or ping-pong message to keep the connection alive. |
Beta Was this translation helpful? Give feedback.
I don't know what you are doing.
I don't know what you mean by "frontend", and since it is a frontend and establishes a connection, is a client, it can't "share" port 8000.
Please see our documentation, and follow the guidelines in our tutorials.
If there is an actual issue, please open an issue, honor the issue template so we can know your scenario and reproduce the issue if necessary, and let us know exactly what you are doing