DavidWebb
DavidWebb copied to clipboard
Canceling a request
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?
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