{"id":18565066,"url":"https://github.com/jenly1314/awebsocket","last_synced_at":"2025-07-22T06:05:00.966Z","repository":{"id":206826872,"uuid":"717786269","full_name":"jenly1314/AWebSocket","owner":"jenly1314","description":":globe_with_meridians: AWebSocket一个基于okhttp封装的WebSocket，简洁易用。","archived":false,"fork":false,"pushed_at":"2024-09-03T16:19:55.000Z","size":3660,"stargazers_count":33,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T18:56:35.681Z","etag":null,"topics":["android","socket","socket-io","socketio","websocket","websocket-chat","websocket-client"],"latest_commit_sha":null,"homepage":"https://jenly1314.github.io/AWebSocket/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenly1314.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-12T15:41:26.000Z","updated_at":"2025-02-20T09:29:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"b933e6ee-3111-4e86-a65c-66993ebba4b4","html_url":"https://github.com/jenly1314/AWebSocket","commit_stats":null,"previous_names":["jenly1314/awebsocket"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jenly1314/AWebSocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2FAWebSocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2FAWebSocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2FAWebSocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2FAWebSocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenly1314","download_url":"https://codeload.github.com/jenly1314/AWebSocket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2FAWebSocket/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266437369,"owners_count":23928235,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["android","socket","socket-io","socketio","websocket","websocket-chat","websocket-client"],"created_at":"2024-11-06T22:17:35.036Z","updated_at":"2025-07-22T06:05:00.959Z","avatar_url":"https://github.com/jenly1314.png","language":"Kotlin","readme":"# AWebSocket\n\n[![MavenCentral](https://img.shields.io/maven-central/v/com.github.jenly1314/awebsocket?logo=sonatype)](https://repo1.maven.org/maven2/com/github/jenly1314/AWebSocket)\n[![JitPack](https://img.shields.io/jitpack/v/github/jenly1314/AWebSocket?logo=jitpack)](https://jitpack.io/#jenly1314/AWebSocket)\n[![CI](https://img.shields.io/github/actions/workflow/status/jenly1314/AWebSocket/build.yml?logo=github)](https://github.com/jenly1314/AWebSocket/actions/workflows/build.yml)\n[![Download](https://img.shields.io/badge/download-APK-brightgreen?logo=github)](https://raw.githubusercontent.com/jenly1314/AWebSocket/master/app/release/app-release.apk)\n[![API](https://img.shields.io/badge/API-21%2B-brightgreen?logo=android)](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)\n[![License](https://img.shields.io/github/license/jenly1314/AWebSocket?logo=open-source-initiative)](https://opensource.org/licenses/apache-2-0)\n\n\n\nAWebSocket for Android 一个基于okhttp封装的 **WebSocket**，简洁易用。\n\n## 效果展示\n\n![Image](GIF.gif)\n\n\u003e 你也可以直接下载 [演示App](https://raw.githubusercontent.com/jenly1314/AWebSocket/master/app/release/app-release.apk)体验效果\n\n## 引入\n\n### Gradle:\n\n1. 在Project的 **build.gradle** 或 **setting.gradle** 中添加远程仓库\n\n    ```gradle\n    repositories {\n        //...\n        mavenCentral()\n    }\n    ```\n\n2. 在Module的 **build.gradle** 中添加依赖项\n    ```gradle\n    implementation 'com.github.jenly1314:awebsocket:1.0.0'\n\n    ```\n\n## 使用\n\n### 使用示例\n\n```kotlin\n// 初始化AWebSocket\nval aWebSocket = AWebSocket(url)\n// 设置监听\naWebSocket.setWebSocketListener(object : WebSocketListener() {\n    override fun onOpen(webSocket: IWebSocket, response: Response) {\n        super.onOpen(webSocket, response)\n        // TODO 连接成功，可以进⾏通信了\n    }\n\n    override fun onMessage(webSocket: IWebSocket, text: String) {\n        super.onMessage(webSocket, text)\n        // TODO 接收消息\n    }\n\n    override fun onMessage(webSocket: IWebSocket, bytes: ByteString) {\n        super.onMessage(webSocket, bytes)\n        // TODO 接收消息\n    }\n\n    override fun onClosing(webSocket: IWebSocket, code: Int, reason: String) {\n        super.onClosing(webSocket, code, reason)\n        // TODO 连接关闭中\n    }\n\n    override fun onClosed(webSocket: IWebSocket, code: Int, reason: String) {\n        super.onClosed(webSocket, code, reason)\n        // TODO 连接已关闭\n    }\n\n    override fun onFailure(webSocket: IWebSocket, t: Throwable, response: Response?) {\n        super.onFailure(webSocket, t, response)\n        // TODO 连接出错\n    }\n})\n\n// 连接\naWebSocket.connect()\n\n//---------------------------\n\n//...\n// 发送消息\naWebSocket.send(data)\n\n//---------------------------\n\n//...\n// 关闭连接\naWebSocket.close()\n\n```\n\n更多使用详情，请查看[app](app)中的源码使用示例或直接查看[API帮助文档](https://jenly1314.github.io/AWebSocket/api/)\n\n## 相关推荐\n\n- [ANetty](https://github.com/jenly1314/ANetty) 基于Netty封装的Android链路通讯库，用以快速开发高性能，高可靠性的网络交互。在保证易于开发的同时还保证其应用的性能，稳定性和伸缩性。\n- [ASocket](https://github.com/jenly1314/ASocket) 一个TCP/UDP协议的封装库，方便快速实现TCP的长连接与UDP的单播、组播、广播等相关通信。\n\n\u003c!-- end --\u003e\n\n## 版本日志\n\n#### v1.0.0：2023-11-12\n* AWebSocket初始版本\n\n---\n\n![footer](https://jenly1314.github.io/page/footer.svg)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenly1314%2Fawebsocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenly1314%2Fawebsocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenly1314%2Fawebsocket/lists"}