What exactly does a “persistent connection” mean?

后端 未结 3 1886
猫巷女王i
猫巷女王i 2020-12-08 15:31

I read about \"HTTP persistent connection\" but somehow I don\'t seem to understand what does persistent mean in this context.
Could you\'ll elaborate?

3条回答
  •  借酒劲吻你
    2020-12-08 15:45

    It means the server doesn't close the socket once it's finished pushing out the response (so the length of the response has to be otherwise indicated, via headers or chunking), so the client can make other requests on the same socket. A web page often requests several other pieces (images, CSS, scripts, ...) on the same server as the page itself, so reusing the socket for some of those further requests to the same server can reduce overall latency compared to closing the original socket and opening new ones for all the follow-on requests.

提交回复
热议问题