Migrate CxxInspectorPackagerConnection to shared OkHttpClient (#55580)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55580

Replace the OkHttpClient.Builder() in CxxInspectorPackagerConnection.DelegateImpl with DevSupportHttpClient.websocketClient. This shares the connection pool and thread pool with all other devsupport WebSocket consumers. Remove the now-unused TimeUnit and OkHttpClient imports.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D93480223

fbshipit-source-id: ff3d742ccb4f484f4906496b1a081377a1b3fa8d
This commit is contained in:
Nicola Corti authored and meta-codesync[bot] committed 2026-02-18 07:38:50 -08:00
1 parent 21d7efaad4
commit 1cef987c1f
1 file changed
+2 -8
@@ -14,14 +14,13 @@ import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip
import com.facebook.proguard.annotations.DoNotStripAny
import com.facebook.react.common.annotations.VisibleForTesting
import com.facebook.react.devsupport.inspector.DevSupportHttpClient
import com.facebook.soloader.SoLoader
import java.io.Closeable
import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import java.util.ArrayDeque
import java.util.Queue
import java.util.concurrent.TimeUnit
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import okhttp3.WebSocket
@@ -173,12 +172,7 @@ internal class CxxInspectorPackagerConnection(
/** Java implementation of the C++ InspectorPackagerConnectionDelegate interface. */
private class DelegateImpl {
private val httpClient =
OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(0, TimeUnit.MINUTES) // Disable timeouts for read
.build()
private val httpClient = DevSupportHttpClient.websocketClient
private val handler = Handler(Looper.getMainLooper())