All Projects → lmxdawn → Him Vue

lmxdawn / Him Vue

Licence: other
开源的H5即时聊天系统 spring-boot + netty + protobuf + vue ~

Projects that are alternatives of or similar to Him Vue

Him Netty
开源的H5即时聊天系统 spring-boot + netty + protobuf + vue ~
Stars: ✭ 194 (+36.62%)
Mutual labels:  protobuf, spring-boot, im, websocket, netty
Netty Websocket Spring Boot Starter
🚀 lightweight high-performance WebSocket framework ( 轻量级、高性能的WebSocket框架)
Stars: ✭ 885 (+523.24%)
Mutual labels:  spring-boot, im, websocket, netty
Im
IM server based on netty. Provides a client jar. Integrate with your own login system.基于netty实现的IM服务端,提供客户端jar包,可集成自己的登录系统
Stars: ✭ 490 (+245.07%)
Mutual labels:  protobuf, spring-boot, im, netty
Nettychat
基于Netty+TCP+Protobuf实现的Android IM库,包含Protobuf序列化、TCP拆包与粘包、长连接握手认证、心跳机制、断线重连机制、消息重发机制、读写超时机制、离线消息、线程池等功能。
Stars: ✭ 1,979 (+1293.66%)
Mutual labels:  protobuf, im, netty
Netty Learning Example
🥚 Netty实践学习案例,见微知著!带着你的心,跟着教程。我相信你行欧。
Stars: ✭ 2,146 (+1411.27%)
Mutual labels:  protobuf, im, netty
Mmorpg
springboot编写的轻量级高性能mmorpg手游服务端框架,基本功能逐渐完善中。
Stars: ✭ 309 (+117.61%)
Mutual labels:  spring-boot, websocket, netty
T Io
解决其它网络框架没有解决的用户痛点,让天下没有难开发的网络程序
Stars: ✭ 1,331 (+837.32%)
Mutual labels:  im, websocket, netty
Brpc Java
Java implementation for Baidu RPC, multi-protocol & high performance RPC.
Stars: ✭ 647 (+355.63%)
Mutual labels:  protobuf, spring-boot, netty
Kingim
KingIM是基于layim的websocket即时通讯系统,底层使用netty。
Stars: ✭ 538 (+278.87%)
Mutual labels:  im, websocket, netty
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (+274.65%)
Mutual labels:  protobuf, websocket, netty
Jetlinks Community
JetLinks 基于Java8,Spring Boot 2.x ,WebFlux,Netty,Vert.x,Reactor等开发, 是一个全响应式的企业级物联网平台。支持统一物模型管理,多种设备,多种厂家,统一管理。统一设备连接管理,多协议适配(TCP,MQTT,UDP,CoAP,HTTP等),屏蔽网络编程复杂性,灵活接入不同厂家不同协议等设备。实时数据处理,设备告警,消息通知,数据转发。地理位置,数据可视化等。能帮助你快速建立物联网相关业务系统。
Stars: ✭ 2,405 (+1593.66%)
Mutual labels:  spring-boot, websocket, netty
Javaquarkbbs
基于Spring Boot实现的一个简易的Java社区
Stars: ✭ 755 (+431.69%)
Mutual labels:  spring-boot, websocket, netty
Mrpc
🐿 netty,zookeeper,spring,kyro rpc framework.
Stars: ✭ 128 (-9.86%)
Mutual labels:  protobuf, spring-boot, netty
Server
Enterprise Open Source IM Solution
Stars: ✭ 53 (-62.68%)
Mutual labels:  spring-boot, im
Springboot Project
这是一个用SpringBoot+JPA打造的基于微信服务号平台的点餐系统的后端,前端是一个使用Vue.js构建的运行于微信公众号的WebApp。前后端完全分离,前后端之间通过RESTful风格的接口相连。
Stars: ✭ 1,034 (+628.17%)
Mutual labels:  spring-boot, websocket
Dorado
基于Netty4开发的简单、轻量级、高性能的的Http restful api server
Stars: ✭ 65 (-54.23%)
Mutual labels:  spring-boot, netty
Gochat
goim server write by golang !🚀
Stars: ✭ 1,144 (+705.63%)
Mutual labels:  im, websocket
Cim
📲cim(cross IM) 适用于开发者的分布式即时通讯系统
Stars: ✭ 8,109 (+5610.56%)
Mutual labels:  im, netty
Easychatandroidclient
EasyChat是一个开源的社交类的App。主要包含消息、好友、群组等相关的IM核心功能。部分界面参照了QQ、微信等相关社交APP。EasyChat APP整体采用MVVM模式,基于JetPack(Lifecycle,LiveData,ViewModel,Room)构建
Stars: ✭ 64 (-54.93%)
Mutual labels:  im, netty
Easyrpc
EasyRpc is a simple, high-performance, easy-to-use RPC framework based on Netty, ZooKeeper and ProtoStuff.
Stars: ✭ 79 (-44.37%)
Mutual labels:  protobuf, netty

him-vue

him-vue him-netty QQ群

vue netty spring-boot

him-vue

使用前先阅读开源协议: 中文版 , English version , 协议出处 Anti-996-License-1.0

前端:vue 前往 ,服务端 netty 前往

踩坑指南

    1. iOS版本手机QQ中清空不了 Cookie 的bug (Android 版本的QQ没试), 其它浏览器均正常
    1. 手机微信中打开后点击输入文字后, 不管点不点击发送按钮都会出现短暂的不能点击的现象(任何按钮都不能点击), 后来发现是因为在微信里面, 输入法把 输入框顶上去了, 然后输入法隐藏后输入框还在上面!!!! 点击查看详情 。找到一个解决输入框的方法: @blur="chatTextBlur" 监听失去焦点的事件(vue 写法), 然后在事件里面执行 window.scroll(0, 0);
    1. 因为设置了定位,overflow: scroll 原生滚动,iOS下会不流畅,解决办法:换成 -webkit-overflow-scrolling: touch;

功能列表

  • [x] 单聊
  • [x] 群聊
  • [x] protobuf 编解码
  • [x] 客户端心跳
  • [x] 客户端断开重连
  • [x] 异地登录, 通知下线
  • [x] 移动端/PC端适配
  • [x] 离线消息 (消息通过 ack 机制, 实现可达性)
  • [x] 第三方QQ登录
  • [x] 自带 emoji 表情
  • [x] 文本消息
  • [ ] 声音提示
  • [ ] 图片消息
  • [ ] 音频消息
  • [ ] 视屏消息
  • [ ] 分布式部署
  • [ ] PHP 版本的 (Workerman 版本)

环境要求

git

这个版本管理肯定需要安装的

node

node 版本最新的即可

vue

构建工具用 vue 目前使用的 2.x 版本

下载

git clone https://github.com/lmxdawn/him-vue.git cd him-vue

安装

npm install

编译

npm run serve 本地测试版

him-vue 前往 和 him-netty 前往 都启动后访问 http://localhost:8080

npm run build 编译命令

注意默认使用 QQ登录, 这个需要去申请QQ互联, 如果不想去申请, 则可以直接设置 Cookie, 两个值 UID 和 SID, 这两个值可以通过接口 /api/user/login/byPwd 获取, 具体请看java 代码

加好友演示

him-vue

加群演示

him-vue

QQ 互联相关配置

java 代码

him-api/src/main/resources/ 这里的配置文件里面, qq.auth.appidqq.auth.appkey 配置上即可

vue 代码

详细配置 根目录下的 .env.development .env.production .env.stage 这三个文件是配置, 分别代表 本地测试,生产环境,线上测试环境

名称 描述
VUE_APP_API_BASE API接口地址
VUE_APP_WEBSOCKET_URL websocket地址
VUE_APP_USER_QR_CODE_URL 生成用户的二维码地址(用来加好友的)
VUE_APP_GROUP_QR_CODE_URL 生成群二维码的地址(用来加群的)
VUE_APP_ROUTER_BASE 如果用了 NGINX 做代理, 并且有二级路径, 则需要配置此项

跨域问题

NGINX 做了端口的代理后, header 头 设置了跨域, 但是还是获取不了, 不知道为啥, 欢迎大神来指导

最后我的解决办法, 全部用一个域名, 然后 NGINX 做路径的转换,下面贴一下我的配置

# 前端路径, 注意这里配置了二级目录后, 需要 vue 的路由里面也需要配置
# 我是写在配置文件里面的 VUE_APP_ROUTER_BASE 这个配置项来控制的
location /h5 {
   try_files $uri $uri/ /h5/index.html;
}
# API 路径
location /api
{
  proxy_pass http://127.0.0.1:9000/api;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "Upgrade";
  proxy_set_header X-Real-IP $remote_addr;
}
# ws 路径
location /ws
{
  proxy_pass http://127.0.0.1:9001;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "Upgrade";
  proxy_set_header X-Real-IP $remote_addr;
}

Him 组件说明

参数 说明 类型 可选值 默认值
isShow 是否显示界面 boolean true
width 宽度 string 100%
height 高度 string 100%
top 定位的顶部位置 string
left 定位的左边位置 string
bottom 定位的底部位置 string
right 定位的右边位置 string
apiBaseUrl api 接口的地址 string
webSocketUrl websocket 的连接地址 string
userQRCodeUrl 用户二维码的生成地址 string
groupQRCodeUrl 群二维码的生成地址 string
isAutoInit 是否自动初始化(如果为 false 需要执行) boolean true
webSocketReconnectMaxCount 尝试重新连接的最大次数 number 5

图床说明

把图片放入 git 版本控制里, 上传到 GitHub 上, 然后 在 GitHub 里打开这个图片 把里面的 blob 改为 raw

例如: https://github.com/lmxdawn/him-vue/blob/master/pic/WechatIMG10.jpeg 改为 https://github.com/lmxdawn/him-vue/raw/master/pic/WechatIMG10.jpeg

我这里直接用的 七牛云的, 因为怕 GitHub 的访问太慢

protobuf 杂谈

说明: 目前所有文件都生成好了,不需要在生成,下面简单说明下

vue 中使用

目前我是安装好了 protobufjs 了,proto 文件放在 /src/proto 目录。 运行命令 pbjs -t json-module -w commonjs -o src/proto/proto.js src/proto/*.proto 即可 由于我添加到了 package.json 中,直接运行 npm run protojs 也可以

页面中引入

上面的执行完成后,会在 src/proto 目录下生成 proto.js 文件,由于 webpack 新版本的原因直接引入该文件会报错 Cannot assign to read only property'exports'of object' 需要修改最后一行代码为export default $root;

import protoRoot from "@/proto/proto"
const WSBaseReqProto = protoRoot.lookup("protocol.WSBaseReqProto");
const WSBaseResProto = protoRoot.lookup("protocol.WSBaseResProto");
// 编码
function (payload) {
    // 加入登录验证
    payload.uid = parseInt(this.getUid());
    payload.sid = this.getSid();
    console.log("发送的信息:");
    let errMsg = WSBaseReqProto.verify(payload);
    console.log("buff 解析错误信息:", errMsg);
    // Create a new message
    const wsData = WSBaseReqProto.create(payload); // or use .fromObject if conversion is necessary
    // Encode a message to an Uint8Array (browser) or Buffer (node)
    return WSBaseReqProto.encode(wsData).finish();
}
// 解码
function (data, cb) {
    let reader = new FileReader();
    reader.readAsArrayBuffer(data);
    reader.onload = () => {
        const buf = new Uint8Array(reader.result);
        const response = WSBaseResProto.decode(buf);
        // 成功回调
        cb(response);
    };
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].