我在安卓和iOS上都有聊天应用。在Android上我用的是Autobahn。在iOS上,我使用SocketRocket。在服务器端,我使用Autobahn实现Python。
有时,由于连接丢失,我的消息将无法在Android上发送。我还没有在iOS上看到过这个问题。我不认为这是服务器问题,因为它一直在iOS上正常工作(据我所知)。我还没重新启动服务器什么的。有时候,这些信息可以在Android上运行。
下面是我试图发送消息的日志消息:
01-18 23:49:51.307 1875-1875/com.greenrobot.yesorno D/de.tavendo.autobahn.WebSocketConnection: opening handshake received
01-18 23:49:51.379 1875-1875/com.greenrobot.yesorno D/MoPub: Refresh disabled for ad unit (8fb0facec32111e295fa123138070049).
01-18 23:49:51.383 1875-1918/com.greenrobot.yesorno D/OpenGLRenderer: endAllStagingAnimators on 0xdd232b80 (ListView) with handle 0xe12c0f00
01-18 23:49:58.960 1875-2726/com.greenrobot.yesorno D/de.tavendo.autobahn.WebSocketReader: run() : ConnectionLost
01-18 23:49:58.961 1875-2726/com.greenrobot.yesorno D/de.tavendo.autobahn.WebSocketReader: ended
01-18 23:49:58.961 1875-1875/com.greenrobot.yesorno D/de.tavendo.autobahn.WebSocketConnection: fail connection [code = 3, reason = WebSockets connection lost
01-18 23:49:58.961 1875-1875/com.greenrobot.yesorno D/de.tavendo.autobahn.WebSocketReader: quit
01-18 23:49:58.961 1875-2727/com.greenrobot.yesorno D/de.tavendo.autobahn.WebSocketWriter: ended
01-18 23:49:58.962 1875-1875/com.greenrobot.yesorno D/de.tavendo.autobahn.WebSocketConnection: worker threads stopped有没有人知道如何解决这个连接丢失的问题,或者您知道另一个用于Android的websocket库吗?
发布于 2016-01-19 05:33:01
Autobahn并不是一个支持良好的Android websocket实现。对我来说,与Autobahn的交易破坏者是SSL/TLS (wss)支持,它似乎仍然不被支持。
这个问题涵盖了现有的安卓websocket实现。答案详细介绍了这些实现中已知的一些问题。根据您的特定项目需求,您可能会消除其中的几个选项。
https://stackoverflow.com/questions/34868969
复制相似问题