customerio / customerio/customerio-android

Allow Clients to Configure OkHttpClient for Improved Performance

Open
#615 3 comments 0 reactions 0 assignees View on GitHub
Customer Love Engineering Support Product Gap Support Escalation
Dominant language
Kotlin
Stars
18
Forks
12
Avg merge
2d 11h
Merged PRs (30d)
44

Description

**Is your feature request related to a problem? Please describe.**

The SDK doesn't allow clients to configure the `OkHttpClient` instance used for network operations. This creates a serious performance drawback since each app should maintain a single `OkHttpClient` instance to share thread pools and connection pools. Multiple instances lead to increased memory usage and reduced efficiency.

**Describe the solution you'd like**

Add a mechanism for clients to supply their own `OkHttpClient` instance during SDK initialization. This would enable:
- Sharing a single `OkHttpClient` across the entire application
- Reusing connection pools and thread pools

**Describe alternatives you've considered**

Exposing configuration options within the SDK would help but still results in multiple `OkHttpClient` instances if the client uses their own instance elsewhere, defeating the purpose of resource sharing.

**Additional context**

The [OkHttp documentation](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-ok-http-client/) recommends creating a single `OkHttpClient` instance and reusing it for all HTTP calls: "each client holds its own connection pool and thread pools. Reusing connections and threads reduces latency and saves memory."

This feature would align the SDK with best practices and allow developers to optimize their applications' network performance.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.