-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android: Allow to provide a different HttpClient implementation #1067
Conversation
79f5092
to
e634277
Compare
@lalitb @sid-dahiya I would like to make Android HTTP client replaceable. Any concerns, suggestions? This will allow us to use our own OkHttp implementation which supports HTTP/2 for AI integration. |
@anod - I am not sure how much different are APIs for OkHttp and (existing) HttpURLConnection, but do you think we can introduce HTTPClient for OkHttp as a module similar to other HTTP Clients here. So there would be two differnt HTTPClients for Android, and right one would be picked through HTTPClientFactory class as below:
|
The problem is including okhttp as dependency. This will require client app to use same or similar version of okhttp Usually libraries provide different implementations as a separate libraries, so the client can decide which implementation to use. Example from retrofit: I can followup with adding a |
lib/android_build/maesdk/src/main/java/com/microsoft/applications/events/HttpClient.java
Outdated
Show resolved
Hide resolved
Sorry for late reply on this. The changes look good in general if we can avoid the intermediate buffer to store the request data. |
@anod - Just wondering if you would like to resolve and go ahead with this PR ? |
Yes, sorry missed the reply, I will take a look on the buffer |
cccdfe2
to
a61567e
Compare
a61567e
to
6fb1cfd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the changes. We can keep for couple of days for @microsoft/1ds-c-sdk-approver to review this before merging.
Subset of changes from #1055 to avoid pulling 3rd party library dependencies into SDK
Example of OkHttp implementation which enablex HTTP/2 support
https://github.com/microsoft/cpp_client_telemetry/blob/b6f41f6e9b974c24902b144ebf271e57ec66b2c5/lib/android_build/maesdk-okhttp/src/main/java/com/microsoft/applications/events/okhttp/OkHttpRequest.java