I have a chat app on Android and also on iOS. On Android I'm using Autobahn. On iOS I'm using SocketRocket. On the server side I'm using Autobahn for Python.
Sometimes my messages will fail to send on Android because the connection is lost. I haven't seen this problem on iOS. I don't think it's a server problem since it works fine all the time on iOS (as far as I can tell). I haven't restarted the server or anything. Sometimes the messages work on Android.
Here's my log message from trying to send a message:
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
Does anyone know how to solve this connection lost problem, or do you know of another websocket library for Android?
Autobahn is not a well supported websocket implementation for Android. The dealbreaker with Autobahn for me was SSL/TLS (wss) support, which appears to still not be supported.
This question covers existing websocket implementations for Android. The answers detail some of the known problems with these implementations. Based on your particular project requirements you may be able to eliminate several of the options.