rabtman / wsmanager Goto Github PK
View Code? Open in Web Editor NEWOkHttp WebSocket Manager for Android
OkHttp WebSocket Manager for Android
你好,设置了pingInterval,onFailure报错:Server-sent frames must not be masked.
请问这个是什么问题,要怎么处理啊?
ps:非常多谢你的开源!
建议不要在框架层强制使用UI线程来处理回调和建立连接。连接建立不应该放到UI线程做;回调是否需要使用UI线程应当由上层业务层决定。
调stopConnect方法时,异常:
08-02 08:44:23.283 26589-26589/com.rabtman.wsdemo W/System.err: java.net.SocketException: Socket closed
08-02 08:44:23.283 26589-26589/com.rabtman.wsdemo W/System.err: at java.net.SocketInputStream.socketRead0(Native Method)
08-02 08:44:23.283 26589-26589/com.rabtman.wsdemo W/System.err: at java.net.SocketInputStream.read(SocketInputStream.java:151)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at java.net.SocketInputStream.read(SocketInputStream.java:120)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at okio.Okio$2.read(Okio.java:139)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at okio.AsyncTimeout$2.read(AsyncTimeout.java:237)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at okio.RealBufferedSource.request(RealBufferedSource.java:67)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at okio.RealBufferedSource.require(RealBufferedSource.java:60)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at okio.RealBufferedSource.readByte(RealBufferedSource.java:73)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.java:113)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:97)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:262)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:201)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:141)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
08-02 08:44:23.284 26589-26589/com.rabtman.wsdemo W/System.err: at java.lang.Thread.run(Thread.java:761)
服务器链接可以,但带参数后连接就有问题了,后台说他没有获取到参数,然后返回的数据和ios和网页都不同,请求链接是wss的,Response返回的里面是https的
基本使用没有问题,第一次使用websocket,还有许多东西需要探索。
断线以后, 无法重连
调试时出I/System.out: CLOSE: 1005 就退出监听了,请教下,okhttp3.5的websocket的oPong函数是删了吗?
初学者,请勿介意
你好使用库 然后连接之后 填写的是ws 显示http 服务器报500 请问我哪儿没有配置好吗?谢谢
客户端和服务端心跳检查时需要发送自定义ping包,请问如何实现?
需要自己写心跳包来维护和server 的连接么?
怎么写ping/pong 呢?
在重连方法中判断了当前网络连接状态,如果未连接直接return了,导致永远无法重新连接,但是这个时候有可能是wife切换4g的情况。希望加入重连次数和时间间隔的配置,现在只能自己写个任务去检查连接状态手动调用startConnect比较麻烦。
断线重连可以设置间隔时间吗 频繁重连服务器会有点压力
确定业务代码只调用了一次该方法,但WsManager中会调用两次,
比如初始 pintInterval 设置的是 10s,但是后面服务端告诉你要 20s,这种怎么设置?
能不能支持一下wss的证书验证啊
要不然使用 wss,就会报:/System.err: at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.