28

Is there any Socket.IO-client available for Java? So far I have only found the official Socket.IO client which is only available for JavaScript and socket.io-java which is only the server.

Teo Klestrup Röijezon
  • 5,097
  • 3
  • 29
  • 37

7 Answers7

21

Limited options at this time:

sound right as far as WebSockets go. Socket.IO's specific wire protocol do not appear to have been implemented in Java yet, so you may have to deal with that yourself.

Gottox
  • 682
  • 6
  • 15
Femi
  • 64,273
  • 8
  • 118
  • 148
3

Judging from http://socket.io under "Supported Transports" it could be several different transport protocols:

WebSocket, Adobe® Flash® Socket, AJAX long polling, AJAX multipart streaming, Forever Iframe, JSONP Polling

So, the question is, what is your server supporting?

From the perspective of Java clients the easiest would be WebSockets.

Peter Knego
  • 79,991
  • 11
  • 123
  • 154
2

If you need a client side implementation, checkout java-socket.io.client I made it a few months ago and I believe some people have forked it and upgraded it to the latest version: https://github.com/clwillingham/java-socket.io.client

clwillingham
  • 43
  • 1
  • 6
1

You can use socket.io-client.java.

See this link for src code.

You can also find a tutorial here

Yaki Klein
  • 3,978
  • 3
  • 37
  • 34
0

There is an other Library it is Jetty: http://www.eclipse.org/jetty/documentation/current/jetty-websocket-client-api.html

Bjoern
  • 36
  • 2
0

Take a look at http://techdroid.kbeanie.com/2011/03/websockets-on-android.html. I only needed the WebSockets, so I stripped out the WebView part as well, the Factory was superfluous also. You can just get away with using https://github.com/anismiles/websocket-android-phonegap/blob/master/src/com/strumsoft/websocket/phonegap/WebSocket.java and implement the SocketIO specifcs yourself.

Geert Weening
  • 1,480
  • 1
  • 13
  • 17