{"id":13848907,"url":"https://github.com/codebutler/android-websockets","last_synced_at":"2025-04-04T06:09:17.090Z","repository":{"id":2819626,"uuid":"3821432","full_name":"codebutler/android-websockets","owner":"codebutler","description":"Bare minimum websockets (hybi13/RFC) client for Android","archived":false,"fork":false,"pushed_at":"2018-06-25T15:03:23.000Z","size":265,"stargazers_count":713,"open_issues_count":23,"forks_count":494,"subscribers_count":51,"default_branch":"master","last_synced_at":"2025-03-28T05:12:23.159Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codebutler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-25T00:57:16.000Z","updated_at":"2025-03-19T07:54:19.000Z","dependencies_parsed_at":"2022-08-01T08:19:49.070Z","dependency_job_id":null,"html_url":"https://github.com/codebutler/android-websockets","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/codebutler%2Fandroid-websockets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebutler%2Fandroid-websockets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebutler%2Fandroid-websockets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebutler%2Fandroid-websockets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codebutler","download_url":"https://codeload.github.com/codebutler/android-websockets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128751,"owners_count":20888235,"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:01:01.378Z","updated_at":"2025-04-04T06:09:17.071Z","avatar_url":"https://github.com/codebutler.png","language":"Java","funding_links":[],"categories":["Java","网络编程"],"sub_categories":[],"readme":"# WebSocket client for Android\n\nA very simple bare-minimum WebSocket client for Android.\n\n## Credits\n\nThe hybi parser is based on code from the [faye project](https://github.com/faye/faye-websocket-node). Faye is Copyright (c) 2009-2012 James Coglan. Many thanks for the great open-source library!\n\nPorted from JavaScript to Java by [Eric Butler](https://twitter.com/codebutler) \u003ceric@codebutler.com\u003e.\n\n## Usage\n\nHere's the entire API:\n\n```java\nList\u003cBasicNameValuePair\u003e extraHeaders = Arrays.asList(\n    new BasicNameValuePair(\"Cookie\", \"session=abcd\");\n);\n\nWebSocketClient client = new WebSocketClient(URI.create(\"wss://irccloud.com\"), new WebSocketClient.Handler() {\n    @Override\n    public void onConnect() {\n        Log.d(TAG, \"Connected!\");\n    }\n\n    @Override\n    public void onMessage(String message) {\n        Log.d(TAG, String.format(\"Got string message! %s\", message));\n    }\n\n    @Override\n    public void onMessage(byte[] data) {\n        Log.d(TAG, String.format(\"Got binary message! %s\", toHexString(data));\n    }\n\n    @Override\n    public void onDisconnect(int code, String reason) {\n        Log.d(TAG, String.format(\"Disconnected! Code: %d Reason: %s\", code, reason));\n    }\n\n    @Override\n    public void onError(Exception error) {\n        Log.e(TAG, \"Error!\", error);\n    }\n}, extraHeaders);\n\nclient.connect();\n\n// Later… \nclient.send(\"hello!\");\nclient.send(new byte[] { 0xDE, 0xAD, 0xBE, 0xEF });\nclient.disconnect();\n```\n\n\n## TODO\n\n* Run [autobahn tests](http://autobahn.ws/testsuite)\n* Investigate using [naga](http://code.google.com/p/naga/) instead of threads.\n\n## License\n\n(The MIT License)\n\t\n\tCopyright (c) 2009-2012 James Coglan\n\tCopyright (c) 2012 Eric Butler \n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy of\n\tthis software and associated documentation files (the 'Software'), to deal in\n\tthe Software without restriction, including without limitation the rights to use,\n\tcopy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n\tSoftware, and to permit persons to whom the Software is furnished to do so,\n\tsubject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in all\n\tcopies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n\tFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n\tCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n\tIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n\tCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\t \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebutler%2Fandroid-websockets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodebutler%2Fandroid-websockets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebutler%2Fandroid-websockets/lists"}