Can a http server detect that a client has cancelled their request?

后端 未结 2 670
庸人自扰
庸人自扰 2020-12-03 07:19

My web app must process and serve a lot of data to display certain pages. Sometimes, the user closes or refreshes a page while the server is still busy processing it. This

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 07:30

    HTTP is stateless, hence the only way to detect a disconnected client is via timeouts.

    See the answers to this SO question (Java Servlet : How to detect browser closing ?).

提交回复
热议问题