From 98c53d95a097cd70acbeae6f719060a8569300e1 Mon Sep 17 00:00:00 2001
From: MySelf <1341933031@qq.com>
Date: Sat, 17 Aug 2019 18:23:56 +0800
Subject: [PATCH 1/7] update
---
Front-End-Testing/chat70.html | 156 ------
Front-End-Testing/chat90.html | 186 -------
README.md | 80 +--
doc/Project-Log-cn.md | 37 --
doc/advice/advice.md | 27 --
doc/design_cn.md | 39 --
doc/detail/Login-cn.md | 213 --------
doc/detail/login_rect.md | 34 --
doc/goal/goal.md | 78 ---
doc/netty-study.md | 40 --
doc/study/1-st.md | 34 --
doc/study/2-st.md | 195 --------
doc/study/mulu.md | 4 -
doc/version/v1.0.0.md | 295 -----------
.../github/unclecatmyself/application.java | 13 -
.../unclecatmyself/auto/AutoConfig.java | 12 -
.../unclecatmyself/auto/ConfigFactory.java | 29 --
.../unclecatmyself/auto/InitServer.java | 47 --
.../unclecatmyself/auto/RedisConfig.java | 36 --
.../bootstrap/AbstractBootstrapServer.java | 99 ----
.../bootstrap/BootstrapServer.java | 16 -
.../bootstrap/NettyBootstrapServer.java | 128 -----
.../backmsg/InChatBackMapService.java | 55 ---
.../backmsg/InChatBackMapServiceImpl.java | 66 ---
.../bootstrap/channel/HandlerServiceImpl.java | 203 --------
.../bootstrap/channel/cache/CacheMap.java | 134 -----
.../bootstrap/channel/cache/WsCacheMap.java | 150 ------
.../channel/http/FromServerService.java | 55 ---
.../channel/http/HttpChannelService.java | 30 --
.../channel/http/HttpChannelServiceImpl.java | 134 -----
.../bootstrap/channel/http/HttpClient.java | 94 ----
.../channel/ws/WebSocketChannelService.java | 51 --
.../channel/ws/WsChannelService.java | 47 --
.../data/InChatToDataBaseService.java | 14 -
.../bootstrap/handler/DefaultHandler.java | 154 ------
.../redisclient/testApplication.java | 22 -
.../bootstrap/verify/InChatVerifyService.java | 15 -
.../unclecatmyself/common/base/Handler.java | 64 ---
.../common/base/HandlerApi.java | 14 -
.../common/base/HandlerService.java | 88 ----
.../common/bean/InChatMessage.java | 113 -----
.../unclecatmyself/common/bean/InitNetty.java | 243 ----------
.../common/bean/SendInChat.java | 39 --
.../common/bean/vo/GetListVO.java | 25 -
.../common/bean/vo/GetSizeVO.java | 34 --
.../common/bean/vo/NotFindUriVO.java | 21 -
.../common/bean/vo/ResultVO.java | 40 --
.../common/bean/vo/SendServer.java | 33 --
.../common/bean/vo/SendServerVO.java | 27 --
.../common/constant/BootstrapConstant.java | 18 -
.../common/constant/Constans.java | 43 --
.../common/constant/HttpConstant.java | 33 --
.../common/constant/LogConstant.java | 53 --
.../common/constant/NotInChatConstant.java | 20 -
.../common/constant/UtilConstant.java | 12 -
.../exception/NoFindHandlerException.java | 15 -
.../NotFindLoginChannlException.java | 14 -
.../unclecatmyself/common/ip/IpUtils.java | 66 ---
.../common/pool/DefaultThreadFactory.java | 41 --
.../common/pool/ExecutorQueue.java | 56 ---
.../common/pool/StandardThreadExecutor.java | 98 ----
.../common/ssl/SecureSocketKeyStore.java | 456 ------------------
.../ssl/SecureSocketSslContextFactory.java | 89 ----
.../ssl/SecureSokcetTrustManagerFactory.java | 63 ---
.../common/ssl/StreamReader.java | 25 -
.../common/ssl/X509CertTool.java | 69 ---
.../unclecatmyself/common/utils/HttpUtil.java | 63 ---
.../common/utils/MessageChangeUtil.java | 44 --
.../common/utils/RedisUtil.java | 59 ---
.../common/utils/RemotingUtil.java | 187 -------
.../unclecatmyself/common/utils/SslUtil.java | 35 --
.../unclecatmyself/demo1/EchoClient.java | 60 +++
.../demo1/EchoClientHandler.java | 46 ++
.../unclecatmyself/demo1/EchoServer.java | 68 +++
.../demo1/EchoServerHandler.java | 31 ++
.../task/DataAsynchronousTask.java | 52 --
.../unclecatmyself/task/DataCallable.java | 30 --
.../users/DataBaseServiceImpl.java | 15 -
.../users/FromServerServiceImpl.java | 49 --
.../github/unclecatmyself/users/MyInit.java | 25 -
.../users/VerifyServiceImpl.java | 21 -
src/main/resources/log4j.properties | 17 -
.../common/utils/RedisUtilTests.java | 51 --
83 files changed, 206 insertions(+), 5581 deletions(-)
delete mode 100644 Front-End-Testing/chat70.html
delete mode 100644 Front-End-Testing/chat90.html
delete mode 100644 doc/Project-Log-cn.md
delete mode 100644 doc/advice/advice.md
delete mode 100644 doc/design_cn.md
delete mode 100644 doc/detail/Login-cn.md
delete mode 100644 doc/detail/login_rect.md
delete mode 100644 doc/goal/goal.md
delete mode 100644 doc/netty-study.md
delete mode 100644 doc/study/1-st.md
delete mode 100644 doc/study/2-st.md
delete mode 100644 doc/study/mulu.md
delete mode 100644 doc/version/v1.0.0.md
delete mode 100644 src/main/java/com/github/unclecatmyself/auto/AutoConfig.java
delete mode 100644 src/main/java/com/github/unclecatmyself/auto/ConfigFactory.java
delete mode 100644 src/main/java/com/github/unclecatmyself/auto/InitServer.java
delete mode 100644 src/main/java/com/github/unclecatmyself/auto/RedisConfig.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/AbstractBootstrapServer.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/BootstrapServer.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/NettyBootstrapServer.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/backmsg/InChatBackMapService.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/backmsg/InChatBackMapServiceImpl.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/channel/HandlerServiceImpl.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/channel/cache/CacheMap.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/channel/cache/WsCacheMap.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/channel/http/FromServerService.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/channel/http/HttpChannelService.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/channel/http/HttpChannelServiceImpl.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/channel/http/HttpClient.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/channel/ws/WebSocketChannelService.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/channel/ws/WsChannelService.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/data/InChatToDataBaseService.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/handler/DefaultHandler.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/redisclient/testApplication.java
delete mode 100644 src/main/java/com/github/unclecatmyself/bootstrap/verify/InChatVerifyService.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/base/Handler.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/base/HandlerApi.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/base/HandlerService.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/bean/InChatMessage.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/bean/InitNetty.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/bean/SendInChat.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/bean/vo/GetListVO.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/bean/vo/GetSizeVO.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/bean/vo/NotFindUriVO.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/bean/vo/ResultVO.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/bean/vo/SendServer.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/bean/vo/SendServerVO.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/constant/BootstrapConstant.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/constant/Constans.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/constant/HttpConstant.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/constant/LogConstant.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/constant/NotInChatConstant.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/constant/UtilConstant.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/exception/NoFindHandlerException.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/exception/NotFindLoginChannlException.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/ip/IpUtils.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/pool/DefaultThreadFactory.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/pool/ExecutorQueue.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/pool/StandardThreadExecutor.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/ssl/SecureSocketKeyStore.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/ssl/SecureSocketSslContextFactory.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/ssl/SecureSokcetTrustManagerFactory.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/ssl/StreamReader.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/ssl/X509CertTool.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/utils/HttpUtil.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/utils/MessageChangeUtil.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/utils/RedisUtil.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/utils/RemotingUtil.java
delete mode 100644 src/main/java/com/github/unclecatmyself/common/utils/SslUtil.java
create mode 100644 src/main/java/com/github/unclecatmyself/demo1/EchoClient.java
create mode 100644 src/main/java/com/github/unclecatmyself/demo1/EchoClientHandler.java
create mode 100644 src/main/java/com/github/unclecatmyself/demo1/EchoServer.java
create mode 100644 src/main/java/com/github/unclecatmyself/demo1/EchoServerHandler.java
delete mode 100644 src/main/java/com/github/unclecatmyself/task/DataAsynchronousTask.java
delete mode 100644 src/main/java/com/github/unclecatmyself/task/DataCallable.java
delete mode 100644 src/main/java/com/github/unclecatmyself/users/DataBaseServiceImpl.java
delete mode 100644 src/main/java/com/github/unclecatmyself/users/FromServerServiceImpl.java
delete mode 100644 src/main/java/com/github/unclecatmyself/users/MyInit.java
delete mode 100644 src/main/java/com/github/unclecatmyself/users/VerifyServiceImpl.java
delete mode 100644 src/main/resources/log4j.properties
delete mode 100644 src/test/java/com/github/unclecatmyself/common/utils/RedisUtilTests.java
diff --git a/Front-End-Testing/chat70.html b/Front-End-Testing/chat70.html
deleted file mode 100644
index 59d409d..0000000
--- a/Front-End-Testing/chat70.html
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
-
- WebSocket Chat
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Front-End-Testing/chat90.html b/Front-End-Testing/chat90.html
deleted file mode 100644
index 3611b0f..0000000
--- a/Front-End-Testing/chat90.html
+++ /dev/null
@@ -1,186 +0,0 @@
-
-
-
-
- WebSocket Chat
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 7273b8e..f1c27d2 100644
--- a/README.md
+++ b/README.md
@@ -15,88 +15,10 @@
本项目入驻[**AwakenCN**](https://github.com/AwakenCN)开源组织,后续将继续更新调整,部分API后续会更改,感谢每一位朋友的支持与关注。
-## 简介
+## 官方教程
-***(InChat)Iot Netty Chat***
-一个轻量级、高效、分布式的异步通信框架, 支持聊天和物联网, 您可以使用它来快速构建具有后台的聊天服务器, 并快速自定义自己的通信 api, 包括具有不同的通讯可以支持的协议。
-
-**欢迎参与QQ群交流与提供建议、业务场景、需求功能等**
-
-**[代码贡献指南](http://www.imooc.com/article/272573)**
-
-> 目前项目更新内容:补充文案、设计稿说明、使用说明等
-
-## Maven版本
-
-功能列表:
-
-> * 用户token登录校验
-> * 自我聊天
-> * 点对点聊天
-> * 群聊
-> * 获取在线用户数与用户标签列表
-> * 发送系统通知
-> * 1.1.3版本新增SSL加密,分布式测试点对点、群聊功能(分布式为试用版,暂不支持SSL加密)
-
-* [InChatV1.1.3版本使用说明](https://unclecatmyself.github.io/2019/01/15/inchatby113/)
-
-```
-
- com.github.UncleCatMySelf
- InChat
- 1.1.3
-
-```
-
-## 里程碑
-
-* [InChat项目里程碑-历史版本](doc/goal/goal.md)
-
-## 项目日志
-
-* [项目研发日志更新](doc/Project-Log-cn.md)
-
-## 教程
-
-### [Netty入门与源码讲解](doc/study/mulu.md)
-
-## 官方案例
-
--
-
-## 项目相关
-
-> * [项目设计思路](doc/design_cn.md)
-> * [登录模块详细设计](doc/detail/Login-cn.md)
-> * [登录模块整改版V0.1](doc/detail/login_rect.md)
-
-## 相关资料(欢迎贡献)
-
-* [QQ群建议贡献](doc/advice/advice.md)
-
-## 效果展示
-
-![加密](https://raw.githubusercontent.com/UncleCatMySelf/img-myself/master/img/inchatGIF/%E5%8A%A0%E5%AF%86.gif)
-![分布式](https://raw.githubusercontent.com/UncleCatMySelf/img-myself/master/img/inchatGIF/%E5%88%86%E5%B8%83%E5%BC%8F.gif)
-![demo](https://github.com/UncleCatMySelf/img-myself/blob/master/img/inchatGIF/inchat_demo.gif)
-![log](https://github.com/UncleCatMySelf/img-myself/blob/master/img/inchatGIF/inchat_log.gif)
-![postman](https://github.com/UncleCatMySelf/img-myself/blob/master/img/inchatGIF/inchat_postman.gif)
-![send](https://github.com/UncleCatMySelf/img-myself/blob/master/img/inchatGIF/inchat_send.gif)
-
-## 下载地址
-
-下载地址:https://github.com/UncleCatMySelf/SBToNettyChat/releases
-
-## 下载 & 问题
-
-https://github.com/UncleCatMySelf/SBToNettyChat/issues
-
-## 关于贡献
-
-[!Noseparte说: 开源项目InChat贡献记](https://www.imooc.com/article/272573)
-
## 公众号:Java猫说
**学习交流群:728698035**
diff --git a/doc/Project-Log-cn.md b/doc/Project-Log-cn.md
deleted file mode 100644
index 4cae52c..0000000
--- a/doc/Project-Log-cn.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# 项目研发日志更新
-
-* 【2018-11-21】 目前Maven包开发目标,设计WebSocket登录接口[详情请看设计文档](design_cn.md)
-* 【2018-11-22】 编码实现WebSocket聊天通讯的登录流程,[撰写说明文档](detail/Login-cn.md)
-* 【2018-11-23】 添加贡献建议信息,重构修改登录检测常量代码,提取成接口形式
-* 【2018-11-26】 登录存储用户token与链接实例,发送给自己功能API,部分功能代码重构
-* 【2018-11-27】 发送消息给在线其他用户,代码部分模块加注释,[撰写设计文档](detail/login_rect.md),但是中途思路有所转变
-* 【2018-11-29】 修复登录下线关闭channel异常BUG,移除原始未重构代码,更新下线模块,与本地在线存储功能。
-* 【2018-11-30】 启动赞助功能,新增【服务端向API发送消息】接口功能,暂未测试
-* 【2018-12-02】 转变部分项目思路,减少用户对框架的依赖与开发成本。
-* 【2018-12-03】 构建【组建群聊】模块功能,整改数据接收Map转为Map,放弃【组建群聊】,仅作基本im业务,完成功能【发送群聊】
-* 【2018-12-04】 明确项目文档的重要性,并设定Netty相关文档说明,与Netty入门说明
-* 【2018-12-05】 移除部分Iot使用的代码(一版暂时还没使用到),清楚pom文件中不用的jar包,需添加【系统时间】参数
-* 【2018-12-06】 确定LOGO并上传,InChat QQ群项目组成立,移除对lombok的依赖,使用传统形式,统一注释说明
-* 【2018-12-14】 打包完成v1.0.0Maven版本,并提交说明文档与相关资料,正对v1.0.0提交对应demo分支。
-* 【2018-12-15】 [录制V1.0.0使用说明视频](https://v.qq.com/x/page/i0813oy0lov.html)
-* 【2018-12-18】 明确移除对SpringBoot的依赖于环境,做成自纯应用。[添加NIO服务端与客户端Demo](https://github.com/UncleCatMySelf/InChat/wiki/Java-NIO%E4%B9%8BSelector%EF%BC%88%E9%80%89%E6%8B%A9%E5%99%A8%EF%BC%89)
-* 【2018-12-19】 移除lombok,嵌入log4j的依赖,并配置日志信息,移除对SpringBoot的依赖成功,普通main方法既可以运行项目。
-* 【2018-12-21】 添加静态配置,添加服务端发送接口,发布V1.1.0-alpha版本,标识性版本。
-* 【2018-12-27】 添加部分注释,修改版本启动模式,并预定后期添加HTTP接入模式,修改日志配置。
-* 【2018-12-28】 预计整改常量、修改部分方法(类)命名,下一版加wss通道。
-* 【2018-12-30】 修改异步线程任务(FutureTask启动模式),整改目录与修改核心类名,捕获未注册时客户端异常断开的连接异常,新增Http接口功能整改(未完)。
-* 【2018-12-31】 下一版InChat 自带几个默认的Http接口 查询【在线用户数】、【服务端发送消息】、【用户在线用户列表】等,暂不支持自定义URI HTTP接口
-* 【2019-01-01】 添加工具方法
-* 【2019-01-02】 修复httpPOST请求接口
-* 【2019-01-03】 完成新版http接口处理与测试,预计发包,新版发布 InChatV1.1.2,更新README展示GIF,录制V1.1.2视频教程与使用说明书
-* 【2019-01-04】 修复文档,确定版本,新增Redis对接
-* 【2019-01-05】 初步转分布式、处理netty集群(未完成)
-* 【2019-01-07】 完成netty集群,多用户跨服务器的消息通讯(HTTP版本)
-* 【2019-01-08】 设定下一版本目标,完成ssl加密,构建代码贡献文档
-* 【2019-01-09】 noseparte贡献代码修改pom与README文件
-* 【2019-01-10】 整改设计文档
-* 【2019-01-15】 完成SSL加密的功能封装,完成分布式下群聊分发功能。发布1.1.3版本
-* 【2019-01-23】 上线InChat-Cloud分布式组件
-* 【2019-03-05】 重新整理添加注释
-
-
diff --git a/doc/advice/advice.md b/doc/advice/advice.md
deleted file mode 100644
index 76b35e9..0000000
--- a/doc/advice/advice.md
+++ /dev/null
@@ -1,27 +0,0 @@
-## QQ群贡献建议
-
-> 贡献者:小斑马
-
-* 一个netty在物联网的应用,质量很高,有些模块可以直接拿来用
-* https://github.com/cosmoplat-dev
-
-* 可以考虑把长连接单独做成一个模块,上行下行数据可以直接放到消息队列里面去,上行数据上来后直接放到消息队列里,其他模块接收存数据库,长连接模块监听其他模块放到消息队列里的下发数据
-
-> 贡献者:夜殇
-
-* 加了规则引擎的物联网项目
-* https://github.com/thingsboard/thingsboard
-
-* 对上方项目的修改
-* https://github.com/JaryZhen/rulegin
-
-> 贡献者:[ELLIOT](https://github.com/chanjjaeseo)
-
-* RabbitMQ 基本操作
-* https://github.com/chanjjaeseo/rabbitMQ-sample
-
-> 贡献者:[noseparte](https://github.com/noseparte)
-
-* [netty4通信原理](../netty-study.md)
-* MongoDB的基本操作
-* https://github.com/noseparte/mongoTeam
diff --git a/doc/design_cn.md b/doc/design_cn.md
deleted file mode 100644
index e45ec5c..0000000
--- a/doc/design_cn.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# 项目设计思路
-
-## 设计原则
-
-AOP、DI为主,基于Spring Boot快速搭建,尽量减少用户的二次搭配开发
-
-## 关于登录
-
-关于InChat统一登录的接口设计,设计针对小程序、APP、Web端的登录作用,所以将作为token的形式登录InChat的WebSocket长连接,用户服务器做sso的认证登录后得到token后直接发送login信息到InChat,用户服务器需要重写InChat中的verifyToken方法校验自己的的Token信息是否有效,正常则启动长连接。考虑到token失效问题,WebSocket长连接的登录仅做初次登录,接下来考虑以心跳形式保持链接状态(pingpong),使用token认证是为保护InChat链接的常规化(目前暂时这样设计后面根据使用情况更改设计)
-
-![Image text](https://raw.githubusercontent.com/UncleCatMySelf/img-myself/master/img/design/%E6%9C%AA%E5%91%BD%E5%90%8D%E6%96%87%E4%BB%B6(12).png)
-
-* 【2018-11-22】 编码实现和[详细实现文档](detail/Login-cn.md)
-
-## 离线消息模板
-
-一版采用RabbitMQ----移除
-
-## 整体设计
-
-![Image text](https://raw.githubusercontent.com/UncleCatMySelf/img-myself/master/img/inchat/%E6%9C%AA%E5%91%BD%E5%90%8D%E6%96%87%E4%BB%B6(19).png)
-
-- 1、移除原本Token概念,用户均以唯一标识登录并存储在线键值对于系统本地Cache。(登录存储、退出移除)
-- 2、DefaultWebSocketHandler,是框架默认的处理,数据均已json格式,拆分业务点
-- 3、由InChat内部的服务(WebSocketHandlerService )进行具体的业务实现并回写
-- 4、对于数据的存储与写入,默认是异步写入数据,用户可以重写InChatToDataBaseService,获取实时数据
-- 5、在高并发情况下,我们不推荐异步处理数据,可以通过配置化启动mq(目前支持RabbitMq),框架自动注入对应Bean,并由MQ来执行数据写入
-- 6、关于数据库连接池,我们不会绑定用户使用,而是支持用户自定义。
-
-## 集群处理设计
-
-![Image](https://raw.githubusercontent.com/UncleCatMySelf/img-myself/master/img/inchat/%E9%9B%86%E7%BE%A4%E8%AE%BE%E8%AE%A1.png)
-
-目前针对刚刚实现的点对点跨服务器接收发送流程:
-- 1、一个服务器承受的用户并发量是有限,所以需要横向扩充服务器,所以会出现多个InChat Server端口,每个服务器都会接收一定用户量的登录并发长连接,
-每个用户登录一个服务器后,都会向Redis发送(key=token、value=【IP:端口】+Channel标签)的加密存储值。
-- 2、当60的A用户想发送给70的B用户时,60通过redis知道这个B用户是在线的,可是本地取不到这个链接就会向redis取对应的这个B用户的token的键值对。
-- 3、60的服务器就会先向A用户发送他已经发出的消息,方便前端显示,同时60服务器拿到B用户的【IP:端口】,通过InChat系统内部二次开通的Http客户端,发送给70服务器。
-- 4、70服务器接收到HTTP请求,这时会向B用户发送这个A用户发送的消息,因为Netty是异步的 ,所以过程是流畅的。
\ No newline at end of file
diff --git a/doc/detail/Login-cn.md b/doc/detail/Login-cn.md
deleted file mode 100644
index 2aa63e7..0000000
--- a/doc/detail/Login-cn.md
+++ /dev/null
@@ -1,213 +0,0 @@
-## 只给你最值得的信息
-
-小弟正在做的一个开源IM项目,目标是实现一个轻量级、高效率的支持聊天与物联网的通讯框架。昨天刚刚出的设计稿并再今天做了实现。
-
-项目是基于Netty的二次开发,关于Netty我这里就不再介绍了,懂的人自然都懂。我的预算是做一个所有企业或组织可以引用的Maven项目,并且是基本上开箱即用,简单实现对应的配置与重写方法就可以搭建自己的IM项目(某Q、某信的效果)。
-
-本文着重介绍的是登录接口的设计与实现。
-
-## 设计信息
-
-关于InChat统一登录的接口设计,设计针对小程序、APP、Web端的登录作用,所以将作为token的形式登录InChat的WebSocket长连接,用户服务器做sso的认证登录后得到token后直接发送login信息到InChat,用户服务器需要重写InChat中的verifyToken方法校验自己的的Token信息是否有效,正常则启动长连接。考虑到token失效问题,WebSocket长连接的登录仅做初次登录,接下来考虑以心跳形式保持链接状态(pingpong),使用token认证是为保护InChat链接的常规化(目前暂时这样设计后面根据使用情况更改设计)
-
-![Image text](https://raw.githubusercontent.com/UncleCatMySelf/img-myself/master/img/inchat/%E6%9C%AA%E5%91%BD%E5%90%8D%E6%96%87%E4%BB%B6(13).png)
-
-由于目前大部分的Web项目或基于IM的项目登录可能存在多端的单点登录,所以我选用了Token的形式,为什么登录后还需要用token再来websocket这边校验一次呢?
-
-因为你登录的是web应用程序端的,而websocket而言,只要别人知道你的地址,那么就可以链接上,我们不希望存在过多的死链接(无效链接),所以我们需要将token再次发给InChat登录,由InChat来检验是否是合法登录链接,如果无效则关闭链接。
-
-## 代码实现
-
-由于是想要做给别人用的,那么我们自己本身就要封装的好一点,对于配置我选了足够多的类型。
-
-![Image text](https://raw.githubusercontent.com/UncleCatMySelf/img-myself/master/img/inchat/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20181122171455.png)
-
-对于netty监听与初始化,我使用的方式是扫描与AspectJ,你可以在项目的auto包中看到扫描启动,这种启动思路我也是参考了其他的开源项目(具体忘记了地址)。
-
-```java
-@Bean
-@ConditionalOnMissingBean(name = "sacnScheduled")
-public ScanRunnable initRunable(@Autowired InitNetty serverBean){
- long time =(serverBean==null || serverBean.getPeriod()<5)?10:serverBean.getPeriod();
- ScanRunnable sacnScheduled = new SacnScheduled(time);
- Thread scanRunnable = new Thread(sacnScheduled);
- scanRunnable.setDaemon(true);
- scanRunnable.start();
- return sacnScheduled;
-}
-
-
-@Bean(initMethod = "open", destroyMethod = "close")
-@ConditionalOnMissingBean
-public InitServer initServer(InitNetty serverBean){
- if(!ObjectUtils.allNotNull(serverBean.getWebport(),serverBean.getServerName())){
- throw new NullPointerException("not set port");
- }
- if(serverBean.getBacklog()<1){
- serverBean.setBacklog(_BLACKLOG);
- }
- if(serverBean.getBossThread()<1){
- serverBean.setBossThread(CPU);
- }
- if(serverBean.getInitalDelay()<0){
- serverBean.setInitalDelay(SEDU_DAY);
- }
- if(serverBean.getPeriod()<1){
- serverBean.setPeriod(SEDU_DAY);
- }
- if(serverBean.getHeart()<1){
- serverBean.setHeart(TIMEOUT);
- }
- if(serverBean.getRevbuf()<1){
- serverBean.setRevbuf(BUF_SIZE);
- }
- if(serverBean.getWorkerThread()<1){
- serverBean.setWorkerThread(CPU*2);
- }
- return new InitServer(serverBean);
-}
-```
-
-
-在上图中存在一个DefaultWebSocketHandler,这个是默认的netty启动处理。
-
-当然在执行它之前,还需要执行到一个抽象的类WebSocketHandler。
-
-它将会为我做一些基本的功能操作。
-
-```java
-@Slf4j
-public abstract class WebSocketHandler extends SimpleChannelInboundHandler