socket.io-client
socket.io-client copied to clipboard
React Native 47 gets xhr poll error with https server that has self signed certificate
You want to:
- [x] report a bug
- [ ] request a feature
Current behaviour
with react-native 0.47 in client and https node server with self signed certificate, i get xhr poll error even with rejectUnauthorized: false ... while i test it on node client with rejectUnauthorized: false and it works. is it a problem with android?
Setup
- socket.io version: 2.0.3
having same issue as above. ios is working fine with cert encrypted via lets encrypt. however does not work on android.
Same issue here
same issue
try last version from github, like this, solved my issues with RN android:
npm i socketio/engine.io-client#3.3.2 -S
For future readers:
This can be achieved with the following configuration:
android/app/src/debug/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<application
android:networkSecurityConfig="@xml/network_security_config"
/>
</manifest>
android/app/src/debug/res/xml/network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!-- needed by the Metro dev server -->
<domain-config cleartextTrafficPermitted="true">
<domain>localhost</domain>
</domain-config>
<domain-config>
<domain>192.168.0.10</domain>
<trust-anchors>
<certificates src="@raw/mycert" />
</trust-anchors>
</domain-config>
</network-security-config>
android/app/src/debug/res/raw/mycert.pem
-----BEGIN CERTIFICATE-----
[...]
-----END CERTIFICATE-----
Added in the documentation here: https://socket.io/how-to/use-with-react-native