Let's encrypt CA websocket fails on Android api < 20
See original GitHub issueIs this a bug report?
Yes
Environment
Environment: OS: macOS Sierra 10.12.6 Node: 9.3.0 Yarn: 1.3.2 npm: 5.6.0 Watchman: 4.7.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 2.1 AI-143.2915827
Packages: (wanted => installed) react: 16.0.0-beta.5 => 16.0.0-beta.5 react-native: 0.49.3 => 0.49.3 Target Platform: iOS (10.3)
Steps to Reproduce
I have a node server which uses Let’s Encrypt CA. I try to connect to it using websockets. On iOS and newer Android versions (API > 20) it connects successfully. When running on older Android versions (both on simulator and actual devices) it never connects. I have tried to connect using older Android version to a server that’s not using Let’s encrypt CA, and it also connects successfully.
The error I get when using this:
ws.onerror = (e) => {
// an error occurred
console.log(e.message);
};
is Connection closed by peer
and this:
ws.onclose = (e) => {
// connection closed
console.log(e.code, e.reason);
};
logs undefined, undefined
Expected Behavior
Connect to the server
Actual Behavior
Fails
Reproducible Demo
var ws = new WebSocket('wss://example.now.sh');
ws.onerror = (e) => {
// an error occurred
console.log(e.message);
};
ws.onclose = (e) => {
// connection closed
console.log(e.code, e.reason);
};
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (1 by maintainers)
Top GitHub Comments
Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?
I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.
How to Contribute • What to Expect from Maintainers
@shamilsun put this into your MainApplication.java file:
I hope that helps
EDIT: Add this too: