firebase / firebase/firebase-android-sdk

Support for alternative HTTP Clients

Open
#5,568 1 comment 0 reactions 0 assignees View on GitHub
api: core type: feature request
Dominant language
Java
Stars
2.6k
Forks
710
Avg merge
2d 23h
Merged PRs (30d)
34

Description

## What feature would you like to see?

`CctTransportBackend.doSend()` is hardcoded to use HttpURLConnection.

https://github.com/firebase/firebase-android-sdk/blob/master/transport/transport-backend-cct/src/main/java/com/google/android/datatransport/cct/CctTransportBackend.java

Ideally this would be easily configurable to share the HTTP Client with other parts of the app, such as image loaders, APIs (retrofit).

This is possible with `URL.setURLStreamHandlerFactory` to either Cronet or OkHttp (via [ObsoleteUrlFactory](https://gist.github.com/swankjesse/dd91c0a8854e1559b00f5fc9c7bfae70))

While it seems possible to replace it via TransportBackendDiscovery in the manifest, it would duplicate a lot of code from CctTransportBackend.

## How would you use it?

For Wear Apps, using OkHttp provides a centralised place to restrict requests when it isn't appropriate, such as avoiding using LTE and logging network traffic. OkHttp has event listeners and interceptors that allow such things.

Contributor guide

Open the contributing guide

Research direction

Start with transport/transport-backend-cct/src/main/java/com/google/android/datatransport/cct/CctTransportBackend.java, especially doSend(), and compare its behavior with TransportBackendDiscovery. Determine how an application could provide or select an HTTP client without duplicating CctTransportBackend; done means the transport backend supports the requested configuration while preserving its existing behavior and the Wear app use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.