socket.io-client icon indicating copy to clipboard operation
socket.io-client copied to clipboard

Socket IO client React Native android 9

Open hafizmuhammadshoaib opened this issue 5 years ago • 11 comments

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!

hafizmuhammadshoaib avatar Jun 02 '19 19:06 hafizmuhammadshoaib

On android 9 it's required to use encrypted connection when connecting via websockets

JonaszPotoniec avatar Jun 11 '19 11:06 JonaszPotoniec

@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 avatar Jun 11 '19 11:06 hafizmuhammadshoaib

@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.

JonaszPotoniec avatar Jun 11 '19 12:06 JonaszPotoniec

<application .... android:usesCleartextTraffic="true" android:theme="@style/AppTheme">

Adding usesCleartextTraffic resolved the issue for me.

SurajMDurgad avatar Jul 11 '19 04:07 SurajMDurgad

for android 9 you need to use https

TwinsOd avatar Sep 11 '19 12:09 TwinsOd

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?

Jaquedeveloper avatar Nov 06 '19 19:11 Jaquedeveloper

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?

zenkhas avatar May 06 '20 04:05 zenkhas

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?

Venukom avatar Jun 03 '20 14:06 Venukom

Same issue plz help

vaibhavg-sdei avatar Jun 26 '20 18:06 vaibhavg-sdei

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

Venukom avatar Jun 26 '20 18:06 Venukom

Same issue plz help https://developer.android.com/training/articles/security-config

Venukom avatar Jun 29 '20 13:06 Venukom

For future readers:

Please check our guide with React Native here: https://socket.io/how-to/use-with-react-native

Please reopen if needed.

darrachequesne avatar Apr 10 '24 10:04 darrachequesne