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

Client won't connect in React Native iOS Release Mode

Open millro04 opened this issue 4 years ago • 8 comments

Describe the bug I am using socket.io-client version 2.3.1 in a React Native app. The client connects just fine in debug mode. However, on a release build the client does not connect. I've seen a handful of StackOverflow posts about this but nothing conclusive as far as what to do.

How can we successfully use socket.io-client in a React Native app in release mode? Only worried about iOS at the moment.

Thank you!

Version I am using version 2.3.1

millro04 avatar Dec 22 '21 21:12 millro04

I have the same problem with react native 0.64.2 and socket.io 2.1.1

These errors are showing up in event connect_error

{"type":"TransportError","description": ["isTrusted":false, "message":"A operação não pôde se erro 2.)"}}

concluída. (KCFErrorDomainCFNetwork

maxHSG avatar Dec 23 '21 16:12 maxHSG

I fixed this bug by updating my iphone to iOS 15.2

maxHSG avatar Dec 27 '21 12:12 maxHSG

That sounds weird indeed. Were you able to debug the issue?

darrachequesne avatar Jan 05 '22 05:01 darrachequesne

Same here!

sajadspeed avatar Jun 09 '23 20:06 sajadspeed

I am experiencing the same ionic webview. Does anyone have any clue?

JaekwanLee avatar Oct 06 '23 19:10 JaekwanLee

I coped similar things in my react-native project.

You can add this to info.plist file.

<key>NSAppTransportSecurity</key>
<dict>
 <key>NSAllowsArbitraryLoads</key>
     <true/>
</dict>

This is really similar as we android:usesCleartextTraffic="true" in AndroidManifest.xml file.

hdoublin avatar Feb 02 '24 18:02 hdoublin

@hdoublin if I understand correctly, in your case the problem was due to using plain HTTP, right?

@sajadspeed @JaekwanLee is that your case?

darrachequesne avatar Feb 05 '24 10:02 darrachequesne

@hdoublin if I understand correctly, in your case the problem was due to using plain HTTP, right?

@sajadspeed @JaekwanLee is that your case?

I don't know, I don't remember :)

sajadspeed avatar Feb 05 '24 10:02 sajadspeed

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 08 '24 16:04 darrachequesne