{"id":15014337,"url":"https://github.com/lmxdawn/him-netty","last_synced_at":"2025-04-09T05:12:47.068Z","repository":{"id":37171858,"uuid":"164049286","full_name":"lmxdawn/him-netty","owner":"lmxdawn","description":"开源的H5即时聊天系统 spring-boot + netty + protobuf + vue ~","archived":false,"fork":false,"pushed_at":"2024-09-19T16:20:33.000Z","size":284,"stargazers_count":347,"open_issues_count":6,"forks_count":94,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-02T04:05:19.245Z","etag":null,"topics":["im","java","netty","protobuf","spring-boot","vue-im","websocket"],"latest_commit_sha":null,"homepage":"http://him-netty.await.fun/h5","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lmxdawn.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-04T02:48:07.000Z","updated_at":"2025-03-27T07:42:43.000Z","dependencies_parsed_at":"2024-10-14T06:01:08.450Z","dependency_job_id":"bdea9767-132f-4ee6-89cf-61b02bb3d5ca","html_url":"https://github.com/lmxdawn/him-netty","commit_stats":{"total_commits":109,"total_committers":5,"mean_commits":21.8,"dds":0.3211009174311926,"last_synced_commit":"8af0555b4931e286f75269b67a3a2bb507ccd912"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmxdawn%2Fhim-netty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmxdawn%2Fhim-netty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmxdawn%2Fhim-netty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmxdawn%2Fhim-netty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lmxdawn","download_url":"https://codeload.github.com/lmxdawn/him-netty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980844,"owners_count":21027808,"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":["im","java","netty","protobuf","spring-boot","vue-im","websocket"],"created_at":"2024-09-24T19:45:29.699Z","updated_at":"2025-04-09T05:12:47.044Z","avatar_url":"https://github.com/lmxdawn.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cdiv align=\"center\"\u003e\n    \u003cp align=\"center\"\u003e\n    \n   [![him-vue](https://github.com/lmxdawn/him-vue/raw/master/pic/him.jpg)](http://him-netty.await.fun/h5)\n   \n\n   \u003c/p\u003e\n   \u003cp align=\"center\"\u003e\n    \n   [![him-vue](https://img.shields.io/badge/him-him--vue-1.svg)](https://github.com/lmxdawn/him-vue)\n   [![him-netty](https://img.shields.io/badge/him-him--netty-1.svg)](https://github.com/lmxdawn/him-netty)\n   [![QQ群](https://img.shields.io/badge/QQ%E7%BE%A4-210277856-orange.svg)](https://shang.qq.com/wpa/qunwpa?idkey=d4965fc7101936dcdea5eb1d05e2eaeb3128f20796028ee937ab516652083c6c)\n   [![](https://badge.juejin.im/entry/5cd6be3ae51d456e5b66ae3d/likes.svg?style=flat-square)](https://juejin.im/post/5cd6be3ae51d456e5b66ae3d)\n    \n   \u003c/p\u003e\n    \n   \u003cp align=\"center\"\u003e\n    \n   [![vue](https://img.shields.io/badge/vue-2.x-1.svg)](https://github.com/vuejs/vue)\n   [![netty](https://img.shields.io/badge/netty-4.1.25.Final-1.svg)](https://github.com/netty/netty)\n   [![spring-boot](https://img.shields.io/badge/spring--boot-2.1.2.RELEASE-1.svg)](https://github.com/spring-projects/spring-boot)\n    \n   \u003c/p\u003e\n\u003c/div\u003e\n\n# him-netty\n\n\u003e 使用前先阅读**开源协议**: [中文版](https://github.com/lmxdawn/him-netty/LICENSE_CN) ,  [English version](https://github.com/lmxdawn/him-netty/LICENSE) , 协议出处 [Anti-996-License-1.0](https://github.com/kattgu7/Anti-996-License)\n\n\u003e 前端：vue  [前往](https://github.com/lmxdawn/him-vue) ，服务端 netty [前往](https://github.com/lmxdawn/him-netty)\n\n# 踩坑指南\n\n\u003e * 1. iOS版本手机QQ中清空不了 Cookie 的bug (Android 版本的QQ没试), 其它浏览器均正常\n\n\u003e * 2. 手机微信中打开后点击输入文字后, 不管点不点击发送按钮都会出现短暂的不能点击的现象(任何按钮都不能点击), 后来发现是因为在微信里面, 输入法把 输入框顶上去了, 然后输入法隐藏后输入框还在上面!!!! [点击查看详情](https://developers.weixin.qq.com/community/develop/doc/00040a43cd4290dedbc7e7f1851400)\n  。找到一个解决输入框的方法:  @blur=\"chatTextBlur\" 监听失去焦点的事件(vue 写法), 然后在事件里面执行 `window.scroll(0, 0);`\n\n\u003e * 3. 因为设置了定位，`overflow: scroll` 原生滚动，iOS下会不流畅，解决办法：换成 `-webkit-overflow-scrolling: touch;`\n\n# 功能列表\n* [x] 单聊\n* [x] 群聊\n* [x] protobuf 编解码\n* [x] 客户端心跳\n* [x] 客户端断开重连\n* [x] 异地登录, 通知下线\n* [x] 移动端/PC端适配\n* [x] 离线消息 (消息通过 ack 机制, 实现可达性)\n* [x] 第三方QQ登录\n* [x] 自带 emoji 表情\n* [x] 文本消息\n* [ ] 声音提示\n* [ ] 图片消息\n* [ ] 音频消息\n* [ ] 视屏消息\n* [ ] 分布式部署\n* [ ] PHP 版本的 (Workerman 版本)\n\n\n# 环境要求 \n\n## git\n\u003e 这个版本管理肯定需要安装的\n\n## jdk \n\u003e JDK 8\n\n## maven \n\u003e 3.6.1\n\n## spring boot \n\u003e 2.1.2\n\n## 下载\n\n\u003e git clone https://github.com/lmxdawn/him-netty.git\n\n\u003e cd him-netty\n\n## SQL的导入\n\n\u003e 创建数据库，名称： him， 把 根目录下 scripts 里面的 him.sql 导入进去 \n\n## 打包\n\n\u003e mvn -Dmaven.test.skip=true clean package\n\n\u003e java -jar him-api/target/him-api-0.0.1-SNAPSHOT.jar\n\n\u003e 如果要加环境配置 --spring.profiles.active=pro 即可， 默认是 dev 环境。\n  **特别要注意：配置文件里面有跨域配置，这个一定要注意**\n\nhim-vue [前往](https://github.com/lmxdawn/him-vue) 和 him-netty [前往](https://github.com/lmxdawn/him-netty) 都启动后访问 http://localhost:8080\n\n注意默认使用 QQ登录, 这个需要去申请QQ互联, 如果不想去申请, 则可以直接设置 Cookie, 两个值 UID 和 SID, 这两个值可以通过接口 /api/user/login/byPwd 获取, 具体请看java 代码\n\n# 加好友演示\n\n[![him-vue](https://github.com/lmxdawn/him-vue/raw/master/pic/user-show-how.gif)](http://him-netty.await.fun/h5)\n\n# 加群演示\n\n[![him-vue](https://github.com/lmxdawn/him-vue/raw/master/pic/group-show-how.gif)](http://him-netty.await.fun/h5)\n\n\n# QQ 互联相关配置\n\n### java 代码\n\u003e him-api/src/main/resources/ 这里的配置文件里面, `qq.auth.appid` 和 `qq.auth.appkey` 配置上即可\n\n### vue 代码\n\u003e 详细配置 根目录下的 \n`.env.development`\n`.env.production`\n`.env.stage` 这三个文件是配置, 分别代表 本地测试,生产环境,线上测试环境\n\n|名称|描述|\n| --- | --- |\n| VUE_APP_API_BASE | API接口地址 |\n| VUE_APP_WEBSOCKET_URL | websocket地址 |\n| VUE_APP_USER_QR_CODE_URL | 生成用户的二维码地址(用来加好友的) |\n| VUE_APP_GROUP_QR_CODE_URL | 生成群二维码的地址(用来加群的) |\n| VUE_APP_ROUTER_BASE | 如果用了 NGINX 做代理, 并且有二级路径, 则需要配置此项 |\n\n# 跨域问题\n\n\u003e NGINX 做了端口的代理后, header 头 设置了跨域, 但是还是获取不了, 不知道为啥, 欢迎大神来指导\n\n\u003e 最后我的解决办法, 全部用一个域名, 然后 NGINX 做路径的转换,下面贴一下我的配置\n\n```\n# 前端路径, 注意这里配置了二级目录后, 需要 vue 的路由里面也需要配置\n# 我是写在配置文件里面的 VUE_APP_ROUTER_BASE 这个配置项来控制的\nlocation /h5 {\n   try_files $uri $uri/ /h5/index.html;\n}\n# API 路径\nlocation /api\n{\n  proxy_pass http://127.0.0.1:9000/api;\n  proxy_http_version 1.1;\n  proxy_set_header Upgrade $http_upgrade;\n  proxy_set_header Connection \"Upgrade\";\n  proxy_set_header X-Real-IP $remote_addr;\n}\n# ws 路径\nlocation /ws\n{\n  proxy_pass http://127.0.0.1:9001;\n  proxy_http_version 1.1;\n  proxy_set_header Upgrade $http_upgrade;\n  proxy_set_header Connection \"Upgrade\";\n  proxy_set_header X-Real-IP $remote_addr;\n}\n```\n\n# protobuf 杂谈\n \n\u003e 说明： 目前所有文件都生成好了，不需要在生成，下面简单说明下\n## java 中使用\n\n下载好 him-netty 后在 protocol 目录下\n\n\u003e 生成 java 类需要安装 安装  protoc 下载地址：https://github.com/protocolbuffers/protobuf/releases，\n\n\u003e 目前下载的 v3.7.1，解压到任意目录  ，然后把这个目录添加到环境变量 Path 中\n\n\u003e 然后 windows 版本执行 `proto.bat` 即可，Linux/Max 运行 `sh proto.sh`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmxdawn%2Fhim-netty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flmxdawn%2Fhim-netty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmxdawn%2Fhim-netty/lists"}