Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Socket.IO Client Implementation in Java
Java JavaScript
#7 Compare This branch is 70 commits ahead, 36 commits behind Gottox:master.
Latest commit cf78e3 @fatshotty New official version
Version 0.2.1 has been deployed


Build Status

This is a simple porting of that allows us to use a maven repository and Google's json parser instead of org.json.JSONObject
In your pom.xml
<!-- in the 'repositories' section -->
  <name> Repository</name>

<!-- in the 'dependencies' section -->
  <version>0.2.1</version> <!-- the desidered version -->

Flattr this git repo

Socket.IO-Client for Java is an easy to use implementation of for Java.

It uses Weberknecht as transport backend, but it's easy to write your own transport. See description below. An XHR-Transport is included, too. But it's not functional in its current state.

The API is inspired by


  • transparent reconnecting - The API cares about re-establishing the connection to the server when the transport is interrupted.
  • easy to use API - implement an interface, instantiate a class - you're done.
  • output buffer - send data while the transport is still connecting. No problem, handles that.
  • meaningful exceptions - If something goes wrong, SocketIO tries to throw meaningful exceptions with hints for fixing.

Status: Connecting with Websocket is production ready. XHR is in beta.

How to use

Using is quite simple. But lets see:

        SocketIO socket = new SocketIO("");
        socket.connect(new IOCallback() {
            public void onMessage(JSONObject json, IOAcknowledge ack) {
                try {
                    System.out.println("Server said:" + json.toString(2));
                } catch (JSONException e) {

            public void onMessage(String data, IOAcknowledge ack) {
                System.out.println("Server said: " + data);

            public void onError(SocketIOException socketIOException) {
                System.out.println("an Error occured");

            public void onDisconnect() {
                System.out.println("Connection terminated.");

            public void onConnect() {
                System.out.println("Connection established");

            public void on(String event, IOAcknowledge ack, Object... args) {
                System.out.println("Server triggered event '" + event + "'");

        // This line is cached until the connection is establisched.
        socket.send("Hello Server!");

For further informations, read the Javadoc.


  • with git

    git clone git://
  • with mercurial

    hg clone

Both repositories are synchronized and up to date.


to build a jar-file:

ant jar
ls jar/socketio.jar

You'll find the in jar/socketio.jar


Please report any bugs feature requests to the Github issue tracker


This Library was designed with portability in mind.

  • Android is fully supported.
  • JRE is fully supported.
  • GWT does not work at the moment, but a port would be possible.
  • JavaME untested.
  • ... is there anything else out there?


There comes a JUnit test suite with Currently it's tested with Eclipse.

You need node installed in PATH.

  • open the project with eclipse
  • open tests/io.socket/
  • run it as JUnit4 test.


  • needs more unit-tests.
  • XhrTransport needs to pass all tests.
  • If websockets are failing (due to proxy servers e.g.), use XHR automaticly instead.

License - the boring stuff...

This library is distributed under MIT Licence.

Sounds so interesting...

You'll find further documentation at the Github Wiki

Something went wrong with that request. Please try again.