{"id":13848056,"url":"https://github.com/Gottox/socket.io-java-client","last_synced_at":"2025-07-12T11:33:08.186Z","repository":{"id":2096901,"uuid":"3037647","full_name":"Gottox/socket.io-java-client","owner":"Gottox","description":"Socket.IO Client Implementation in Java","archived":true,"fork":false,"pushed_at":"2022-03-22T20:49:13.000Z","size":1738,"stargazers_count":951,"open_issues_count":89,"forks_count":387,"subscribers_count":101,"default_branch":"master","last_synced_at":"2024-08-05T19:35:23.062Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gottox.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-12-23T00:51:23.000Z","updated_at":"2024-06-25T02:41:21.000Z","dependencies_parsed_at":"2022-07-14T20:17:23.175Z","dependency_job_id":null,"html_url":"https://github.com/Gottox/socket.io-java-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gottox%2Fsocket.io-java-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gottox%2Fsocket.io-java-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gottox%2Fsocket.io-java-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gottox%2Fsocket.io-java-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gottox","download_url":"https://codeload.github.com/Gottox/socket.io-java-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225820303,"owners_count":17529138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T19:00:39.824Z","updated_at":"2024-11-21T23:30:55.203Z","avatar_url":"https://github.com/Gottox.png","language":"Java","readme":"[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=Gottox\u0026url=https://github.com/Gottox/socket.io-java-client\u0026title=socket.io-java-client\u0026language=\u0026tags=github\u0026category=software)\n\n# Socket.IO-Client for Java\n\nsocket.io-java-client is an easy to use implementation of [socket.io](http://socket.io) for Java.\n\nIt uses [Weberknecht](http://code.google.com/p/weberknecht/) as transport backend, but it's easy\nto write your own transport. See description below. An XHR-Transport is included, too. But it's\nnot functional in its current state.\n\nThe API is inspired by [java-socket.io.client](https://github.com/benkay/java-socket.io.client).\n\nFeatures:\n\n * __transparent reconnecting__ - The API cares about re-establishing the connection to the server\n   when the transport is interrupted.\n * __easy to use API__ - implement an interface, instantiate a class - you're done.\n * __output buffer__ - send data while the transport is still connecting. No problem, socket.io-java-client handles that.\n * __meaningful exceptions__ - If something goes wrong, SocketIO tries to throw meaningful exceptions with hints for fixing.\n\n__Status:__ Connecting with Websocket is production ready. XHR is in beta.\n\n\n## How to use\n\nUsing socket.io-java-client is quite simple. But lets see:\n\nCheckout and compile the project:\n\n``` bash\ngit clone git://github.com/Gottox/socket.io-java-client.git\ncd socket.io-java-client\nant jar\nmv jar/socketio.jar /path/to/your/libs/project\n```\n\nIf you're using ant, change your build.xml to include socketio.jar. If you're eclipse, add the jar to your project buildpath.\n\nAfterwards, you'll be able to use this library: \n\n``` java\n\n\t\tSocketIO socket = new SocketIO(\"http://127.0.0.1:3001/\");\n\t\tsocket.connect(new IOCallback() {\n\t\t\t@Override\n\t\t\tpublic void onMessage(JSONObject json, IOAcknowledge ack) {\n\t\t\t\ttry {\n\t\t\t\t\tSystem.out.println(\"Server said:\" + json.toString(2));\n\t\t\t\t} catch (JSONException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onMessage(String data, IOAcknowledge ack) {\n\t\t\t\tSystem.out.println(\"Server said: \" + data);\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onError(SocketIOException socketIOException) {\n\t\t\t\tSystem.out.println(\"an Error occured\");\n\t\t\t\tsocketIOException.printStackTrace();\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onDisconnect() {\n\t\t\t\tSystem.out.println(\"Connection terminated.\");\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onConnect() {\n\t\t\t\tSystem.out.println(\"Connection established\");\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void on(String event, IOAcknowledge ack, Object... args) {\n\t\t\t\tSystem.out.println(\"Server triggered event '\" + event + \"'\");\n\t\t\t}\n\t\t});\n\t\t\n\t\t// This line is cached until the connection is establisched.\n\t\tsocket.send(\"Hello Server!\");\n\n```\n\nFor further informations, read the [Javadoc](http://s01.de/hgexport/socket.io-java-client/).\n\n * [Class SocketIO](http://s01.de/~tox/socket.io-java-client/io/socket/SocketIO.html)\n * [Interface IOCallback](http://s01.de/~tox/socket.io-java-client/io/socket/IOCallback.html)\n \n## Checkout\n\n * with git\n \n\t\tgit clone git://github.com/Gottox/socket.io-java-client.git\n\n * with mercurial\n \n \t\thg clone https://bitbucket.org/Gottox/socket.io-java-client \n \nBoth repositories are synchronized and up to date.\n\n## Building\n\nto build a jar-file:\n\n\tcd $PATH_TO_SOCKETIO_JAVA\n\tant jar\n\tls jar/socketio.jar\n\nYou'll find the socket.io-jar in jar/socketio.jar \n\n## Bugs\n\nPlease report any bugs feature requests to [the Github issue tracker](https://github.com/Gottox/socket.io-java-client/issues)\n\n## Frameworks\n\nThis Library was designed with portability in mind.\n\n* __Android__ is fully supported.\n* __JRE__ is fully supported.\n* __GWT__ does not work at the moment, but a port would be possible.\n* __Java ME__ does not work at the moment, but a port would be possible.\n* ... is there anything else out there?\n\n## Testing\n\nThere comes a JUnit test suite with socket.io-java-client. Currently it's tested with Eclipse.\n\nYou need node installed in PATH.\n\n * open the project with eclipse\n * open tests/io.socket/AllTests.java\n * run it as JUnit4 test.\n\n## TODO\n\n* Socket.io needs more unit-tests.\n* XhrTransport needs to pass all tests.\n* If websockets are failing (due to proxy servers e.g.), use XHR automaticly instead.\n\n## License - the boring stuff...\n\nThis library is distributed under MIT Licence.\n\n## Sounds so interesting...\n\nYou'll find further documentation at the [Socket.io-java-client Github Wiki](https://github.com/Gottox/socket.io-java-client/wiki)\n","funding_links":[],"categories":["Java","III. Network and Integration","网络编程"],"sub_categories":["2. Networking"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGottox%2Fsocket.io-java-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGottox%2Fsocket.io-java-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGottox%2Fsocket.io-java-client/lists"}