7

I'm writing a messaging app. My server is built on node.JS and socket.io. My client should be an Android application. However, I can't seem to find a decent library that gives me a Java interface to Socket.IO (by way of websockets?). Is there some library that exists? Or do I have to fall back on another solution (which one?)?

I've found this library for cocoa: https://github.com/fpotter/socketio-cocoa. Any alternatives for Android?

Thanks!

philipDS
  • 661
  • 3
  • 7
  • 16
  • possible duplicate of [Java socket.io client](http://stackoverflow.com/questions/5783086/java-socket-io-client) – user207421 May 16 '11 at 10:15

1 Answers1

14

The accepted answer was lacking. They are Java Socket.IO implementations, which require netty, or only had WebSocket support. I ended up writing my own Socket.IO client on top of a lightweight WebSocket client.

https://github.com/koush/AndroidAsync

koush
  • 2,972
  • 28
  • 31
  • 4
    Hi koush I tried your implementation but does not work with tornadio2 + socket.io v.9. I am now using https://github.com/Gottox/socket.io-java-client which also is fully compatible with Android. – Eric Chen Jun 14 '12 at 17:30
  • @e_x_p I am also using Gottox socket.io library for my application. Everything works fine except execution gets blocked on disconnection. I am not getting any exception.. Excecution just blocks.. – Krishnabhadra Jul 30 '12 at 10:02
  • 1
    @Krishnabhadra this might be late but I did submit an issue https://github.com/Gottox/socket.io-java-client/issues/28. While it's still not fixed by the author I modified the code in my own app. – Eric Chen Nov 10 '12 at 17:52
  • yes, koush's implementation is not working on v.9, I get this error on server: `destroying non-socket.io upgrade` and this error on client: `WebSocket.onError, Exception: java.lang.IllegalArgumentException: Value to parse may not be null. at org.apache.http.message.BasicLineParser.parseStatusLine(BasicLineParser.java:378) at com.codebutler.android_websockets.WebSocketClient.parseStatusLine(WebSocketClient.java:148)` – Zennichimaro Nov 23 '12 at 02:08
  • Hi koush, I couldn't find a way to ask a question on github. Do you have any plans (or know of a fork of your project) using http long polling as fallback when a connection via web-sockets fails? – sunadorer Jan 08 '13 at 18:36
  • @sunadorer Nope, but I'll take any pull requests. – koush Jan 11 '13 at 02:48