{"id":18664632,"url":"https://github.com/scionoftech/socketiowithandroid","last_synced_at":"2025-11-06T10:30:26.187Z","repository":{"id":36307408,"uuid":"40612023","full_name":"scionoftech/SocketIOwithAndroid","owner":"scionoftech","description":"A small project to explain how to use SocketIO with Android(Client) and Node.js(Server).","archived":false,"fork":false,"pushed_at":"2015-08-14T14:52:56.000Z","size":1984,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-27T17:23:36.499Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scionoftech.png","metadata":{"files":{"readme":"README.md","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":"2015-08-12T16:35:53.000Z","updated_at":"2015-08-14T14:52:57.000Z","dependencies_parsed_at":"2022-09-04T20:01:23.118Z","dependency_job_id":null,"html_url":"https://github.com/scionoftech/SocketIOwithAndroid","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/scionoftech%2FSocketIOwithAndroid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scionoftech%2FSocketIOwithAndroid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scionoftech%2FSocketIOwithAndroid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scionoftech%2FSocketIOwithAndroid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scionoftech","download_url":"https://codeload.github.com/scionoftech/SocketIOwithAndroid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239491352,"owners_count":19647811,"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-11-07T08:24:21.554Z","updated_at":"2025-11-06T10:30:26.107Z","avatar_url":"https://github.com/scionoftech.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"#SocketIO with Android\n\nA small project to explain how to use SocketIO with Android(Client) and Node.js(Server).\n\nThis project uses three jar files which are,\n\n* [socket.io-client](http://mvnrepository.com/artifact/com.github.nkzawa/socket.io-client/0.6.0)\n+ [engine.io-client](http://mvnrepository.com/artifact/com.github.nkzawa/engine.io-client/0.6.0)\n- [Java-WebSocket](http://mvnrepository.com/artifact/org.java-websocket/Java-WebSocket/1.3.0)\n\n##How to use in Android\n  ```java\n \t\n    //this Singleton class listen for data push and sends data to server\n    SingeltonSocket socket = SingeltonSocket.getInstance();\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n        //run socket first\n        socket.run();\n        //pass context to receive reponse in this Activity\n        socket.setProperties(this);\n\n        Toolbar toolbar=(Toolbar)findViewById(R.id.appbar);\n        setSupportActionBar(toolbar);\n        setTitle(\"SocketIO With Android\");\n\n        final EditText input = (EditText) findViewById(R.id.input);\n        Button send = (Button) findViewById(R.id.send);\n        send.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View v) {\n                //emmit data to server with key\n                socket.emit(\"test\", input.getText().toString());\n            }\n        });\n\n    }\n\n        //response can be received here\n    @Override\n    public void setData(String data, String tag) {\n        final String message=data;\n        if(tag.equals(\"test_response\"))\n        {\n            runOnUiThread(new Runnable() {\n                @Override\n                public void run() {\n                    Toast.makeText(MainActivity.this,message,Toast.LENGTH_LONG).show();\n                }\n            });\n        }else {\n\n        }\n\n    }\n```\n##How to use in Node.js\n ```js\nvar express=require('express');\nvar app=express();\nvar http= require('http').createServer(app);\nvar io=require('socket.io').listen(http);\n\n/*app.get('/',function(req,res)\n{\n    res.send(\"hello world\");\n});*/\n\n//socket.io listen for events\nio.on('connection', function(socket){\n\n//this what you sent from Client(Android)\nsocket.on('test',function(data)\n{\n\nconsole.log(data);\n//this what you sent to client(Android)\nsocket.emit('test_response',\"i got you\");\n\n});\n});\n\n//port\nhttp.listen(3000, function(){\nconsole.log('listening on *:3000');\n\n});\n ```\n## License\n\n  [ISC](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscionoftech%2Fsocketiowithandroid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscionoftech%2Fsocketiowithandroid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscionoftech%2Fsocketiowithandroid/lists"}