websocket onmessage is not firing after connection established in 0.68.0 #33774
Labels
Impact: Bug
The issue represents a bug somewhere
Platform: Android
Android applications.
Priority: Mid
Resolution: Answered
When the issue is resolved with a simple answer
Tech: React Native Core
Issue related to the Core of React Native
Type: New Architecture
Issues and PRs related to new architecture (Fabric/Turbo Modules)
Description
I have developed an application using React-native@0.64.3 and react-native-websocket@^1.0.2, everything was working fine in both android and iOS, but after upgrading to the react-native version to 0.68.1, WebSocket onMessage stopped firing in android after the connection got established.
Version
0.65.0 onwards
Output of
npx react-native info
System:
OS: macOS 12.3.1
CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
Memory: 144.39 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.8.0 - /usr/local/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.8.0 - /usr/local/bin/npm
Watchman: 2022.03.21.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK:
API Levels: 28, 29, 30, 31
Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0
Android NDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8309675
Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: ^0.68.1 => 0.68.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
import React from 'react';
import {
SafeAreaView,
StyleSheet,
} from 'react-native';
import WS from 'react-native-websocket';
const socketRef = React.createRef(null);
const App = () => {
return (
<WS
ref={socketRef}
url="wss://yourwebsocketurl" //Need to replace with your webservice which will trigger onmessge just after connection got established.
onOpen={() => {
console.log('Open!')
}}
onMessage={(event) => { console.log("onMessage", event) }}
onError={console.log}
onClose={console.log}
// reconnect // Will try to reconnect onClose
/>
);
};
Snack, code example, screenshot, or link to a repository
No response
The text was updated successfully, but these errors were encountered: