endel / NativeWebSocket

🔌 WebSocket client for Unity - with no external dependencies (WebGL, Native, Android, iOS, UWP)
Other
1.13k stars 155 forks source link

Websocket wss not connect build android #20

Open ramaha1565 opened 3 years ago

ramaha1565 commented 3 years ago

when I build for android the websocket does not want to connect, although it works fine on the pc

duchuy413 commented 3 years ago

I have the same issue with wss. It works finr on pc but not in android build

ntilborg commented 3 years ago

I have exactly the same problem with websockets during a "normal" Android build. The error is as below:

Normal build:

10-21 16:54:57.540 18662 20335 E Unity   : Unable to find advapi32
10-21 16:54:57.790 18662 20335 I Unity   : Error! Unable to connect to the remote server

But.... when building a "development build" for Android, the entire application is working, though with still the same error not able to find advapi32. Anyone have a clue why development build is different in this sense?

Development build:

10-21 16:55:49.885 18663 20518 D Unity   : Failed to load native plugin: Unable to lookup library path for 'advapi32'.
10-21 16:55:49.886 18663 20518 E Unity   : Unable to find advapi32
10-21 16:55:50.407 18663 20518 I Unity   : Connection open!
Shorino commented 3 years ago

I have the exact same issues with @ntilborg , will be very happy if someone or devs can provide a solution.

elmisback commented 3 years ago

If your client is some kind of platform that can't dynamically look up certificates (e.g. Unity on Android apparently?), unity-tlsexception-handshake-failed-unitytls-x509verify-flag-not-trusted might be the issue. I had this issue when using Letsencrypt for my server. I fixed the problem by using fullchain.pem instead of cert.pem.

devwithu commented 2 years ago

Try this. Player Settings -> Other Settings ->Internet Access = Requiere. and build.

some info. on Developmnet build unity add '<uses-permission android:name="android.permission.INTERNET />' but normal build unity does not add internet permition. https://stackoverflow.com/questions/38894013/unity-app-works-on-development-build-not-on-normal-one