socketio / socket.io-client-java

Full-featured Socket.IO Client Library for Java, which is compatible with Socket.IO v1.0 and later.
https://socketio.github.io/socket.io-client-java/installation.html
Other
5.34k stars 975 forks source link

Whether to support Android 11? #692

Closed phoenix3k closed 2 years ago

phoenix3k commented 2 years ago

socket.io-client version is 2.0.1 and socket.io-server version is 4.2.0, but Cannot connect when running on Android 11. The same code is normal to run on Android 8.

darrachequesne commented 2 years ago

That sounds weird, are you getting any error? Could you enable the logs, to check if everything is right?

phoenix3k commented 2 years ago

I found out what caused this situation, starting from android 9, it is not allowed to use http protocol for network communication, must use https or modify the configuration file. It's not socketio's problem, but Google modified the rules of network access. thank you very much. 

------------------ 原始邮件 ------------------ 发件人: "socketio/socket.io-client-java" @.>; 发送时间: 2021年11月16日(星期二) 晚上9:23 @.>; @.**@.>; 主题: Re: [socketio/socket.io-client-java] Whether to support Android 11? (Issue #692)

That sounds weird, are you getting any error? Could you enable the logs, to check if everything is right?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

darrachequesne commented 2 years ago

@phoenix3k oh, yes, that's right. We should definitely add this in the documentation.

iyxan23 commented 2 years ago

I faced this same issue, turns out you will need to set usesCleartextTraffic on AndroidManifest.xml so that your app can request with the http protocol: https://developer.android.com/guide/topics/manifest/application-element#usesCleartextTraffic

darrachequesne commented 2 years ago

Added in the documentation here: https://socketio.github.io/socket.io-client-java/android.html#How_to_reach_an_HTTP_server.3F

Please reopen if needed.