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!

1

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

6 Comments

Hi koush I tried your implementation but does not work with tornadio2 + socket.io v.9. I am now using github.com/Gottox/socket.io-java-client which also is fully compatible with Android.
@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 this might be late but I did submit an issue 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.
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)
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?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.