fix(network-activity-plugin): remove private react-native WebSocketInterceptor import - #398
Merged
V3RON merged 2 commits intoAug 13, 2026
Conversation
…ebSocket interceptor Vendors the WebSocket interception logic locally instead of importing react-native/Libraries/WebSocket/WebSocketInterceptor, using the public TurboModuleRegistry/NativeEventEmitter APIs to look up the native module. Avoids breakage under React Native's Strict TypeScript API, which blocks deep imports into Libraries/* and src/private/*. Claude-Session: https://claude.ai/code/session_01JaNGs52mExzVBMFbjLgWgo
V3RON
deleted the
fix/network-activity-plugin-websocket-interceptor-private-api
branch
August 13, 2026 07:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
@rozenite/network-activity-pluginimported React Native's privatereact-native/Libraries/WebSocket/WebSocketInterceptormodule to power the network inspector's WebSocket tab. This deep import path resolves tonullunder React Native's Strict TypeScript API, which breaks module resolution for apps that opt into it.This PR vendors the interceptor logic locally instead, rebuilt entirely on React Native's public API surface, so the package no longer depends on any private React Native module path.
Related Issue
Closes #396
Context
native-websocket-module.ts, which looks up the native WebSocket module via the publicTurboModuleRegistry.getEnforcing('WebSocketModule')instead of importingNativeWebSocketModulefromLibraries/WebSocket/.websocket-interceptor.tsto reimplement the connect/send/sendBinary/close monkey-patching and event subscription logic using the publicNativeEventEmitterexport, keeping the sameWebSocketInterceptorinterface sowebsocket-inspector.tsrequired no changes.WebSocketInterceptorPreRN079) — since this package now owns the callback wiring end-to-end, there's nothing external to compensate for.websocket-interceptor-types.d.tsambient module declaration.base64-js(previously only an indirect dependency viareact-native) as an explicit dependency for the binary-message display helper.Testing
pnpm --filter @rozenite/network-activity-plugin typecheckpnpm --filter @rozenite/network-activity-plugin lintpnpm --filter @rozenite/network-activity-plugin test— 197 tests passed