DavidWebb icon indicating copy to clipboard operation
DavidWebb copied to clipboard

Canceling a request

Open Murphybro2 opened this issue 9 years ago • 1 comments

I keep the connection open by holding the request on the server and not releasing it until something happens or the 30 seconds passes. However when I suddenly log out or an exception occurs I need something that will close the connection and cancel any outstanding requests. Does this function exist?

Murphybro2 avatar Jan 20 '16 13:01 Murphybro2

Seems to be rather complicated (searching StackOverflow e.g.), see

  • http://stackoverflow.com/a/11927939/2176962
  • http://stackoverflow.com/a/8284152/2176962

I haven't tried it, but maybe OkHttp could help you: https://github.com/square/okhttp/wiki/Recipes#canceling-a-call

hgoebl avatar Jan 20 '16 14:01 hgoebl