socket.io-client
socket.io-client copied to clipboard
Socket IO client React Native android 9
Android version 9
Socket io client is not working on android 9 when running the app from release build. It is working perfectly till android version 8.0 and debug build is also running fine at android version 9. Please help me with this.
Thank you!
On android 9 it's required to use encrypted connection when connecting via websockets
@JonaszPotoniec how can we made encrypted connection I am using socket.io on nodejs and sokcet.io-client on the client side. I appreciate if you give me some useful links
@hafizmuhammadshoaib I think the easiest way is to create certificate with certbot and set up the reverse proxy in nginx to your node server. I believe it's the best method as it's fast to set up and doesn't require you to change your server source code.
<application .... android:usesCleartextTraffic="true" android:theme="@style/AppTheme">
Adding usesCleartextTraffic resolved the issue for me.
for android 9 you need to use https
What did you do to fix it?
android:usesCleartextTraffic="true"
Did not work for me.
Nor this: https://stackoverflow.com/questions/58720903/socket-io-stopped-working-after-updating-android-sdk-to-28
Do I have to make any change in my backend?
The actual issues is we're not using the certificate to connect via HTTPS, is there any way we can define the path to certificate on this library?
I am also facing the same issue, with HTTPS, tried to pass the cert in options ca: but it is not working. Is there any solution for this?
Same issue plz help
It is working after adding the cert to the network config, latest version of Android is blocking HTTPS calls without proper cert.
https://developer.android.com/training/articles/security-config
Same issue plz help https://developer.android.com/training/articles/security-config
For future readers:
Please check our guide with React Native here: https://socket.io/how-to/use-with-react-native
Please reopen if needed.