Esri / runtime-questions

Welcome to the 2017 Esri Developer Summit and the session called, "Everything (or Anything) You Wanted to Know About the ArcGIS Runtime SDKs but Were Afraid to Ask"
12 stars 7 forks source link

HttpClient handler #154

Closed jeremy-bridges closed 5 years ago

jeremy-bridges commented 6 years ago

Is there plans to have an API to inject a custom http handler?

jeremy-bridges commented 6 years ago

Also, is there plans to reduce the number of new instances of HttpClient that the runtime creates? There's overhead in making a lot of those:

https://stackoverflow.com/questions/22560971/what-is-the-overhead-of-creating-a-new-httpclient-per-call-in-a-webapi-client

dotMorten commented 6 years ago

Yes. Update 3 will have a way to do this. With Xamarin.Android you can use the XA_HTTP_CLIENT_HANDLER_TYPE environment to use a different handler (this is normally set via the project settings, but can also be set to a custom type via code). That is documented here: https://developer.xamarin.com/guides/android/advanced_topics/environment/ and you can see the implementation here: https://github.com/xamarin/xamarin-android/blob/0c26b71339a1027902f72e3842077feb7d9c7d9b/src/Mono.Android/Android.Runtime/AndroidEnvironment.cs#L319