Giter Site home page Giter Site logo

Comments (2)

zwc456baby avatar zwc456baby commented on June 2, 2024

而且收不到回调,public void onError(Throwable e) 一直没有调用

from rxwebsocket.

zwc456baby avatar zwc456baby commented on June 2, 2024

通过确认,不是 这个库的问题,Okhttp 也有同样的问题,后台时,只有短暂的一段时间可以联网,之后会一直无法连接上。
后来使用基于Java 的websocket,同样会出现如下错误

java.net.ConnectException: failed to connect to xxx/xxx (port 7196) from /:: (port 44712): connect failed: ETIMEDOUT (Connection timed out)

解决方法

当出现上面从 ConnectException 时,启动一个前台服务(或者前台 Activity),然后再回到后台,即可联网
(测试手机:小米8)
app已经开启了后台联网权限,但还是会这样,猜测是系统有某种限制。

只要启动任意一个前台服务(不需要做任何额外工作),再回到后台,就可以恢复连接。而且后续不会再报同样的错误。

from rxwebsocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.