https://kotlinlang.org logo
#ktor
Title
# ktor
d

Dario Pellegrini

10/27/2020, 1:19 PM
Hello everyone! Is there a way in Ktor to detect whenever a reques is canceled by the client? I have a long running process which could be canceled and I’d like to release some file resources it uses on client request’s cancellation. Can someone help me in doing this?
j

Joris PZ

10/27/2020, 4:56 PM
How would the client cancel a request? Since the HTTP protocol does not support cancellation, the only thing I can think of is a client actively dropping the TCP connection with the server. I'm not sure how Ktor deals with clients disconnecting while processing a request, and if you can tap into that to cancel whatever job you are running.
2 Views