基于t-io研发的轻量、高性能、单机支持几十万至百万在线用户IM
<div style="color: black; text-align: left; margin-bottom: 10px;">
<h1 style="color: black; text-align: left; margin-bottom: 10px;">J-IM简介</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">J-IM 是用 JAVA 语言,基于 t-io <span style="color: black;">研发</span>的轻量、高性能、单机支持几十万至百万在线用户 IM,<span style="color: black;">重点</span><span style="color: black;">目的</span>降低即时通讯门槛,快速打造低成本接入在线 IM 系统,<span style="color: black;">经过</span>极简洁的<span style="color: black;">信息</span>格式就<span style="color: black;">能够</span>实现多端<span style="color: black;">区别</span>协议间的<span style="color: black;">信息</span>发送如内置(Http、Websocket、Tcp 自定义 IM 协议)等,并<span style="color: black;">供给</span><span style="color: black;">经过</span> http 协议的 api 接口进行<span style="color: black;">信息</span>发送无需关心接收端属于什么协议,一个<span style="color: black;">信息</span>格式搞定一切!</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">JavaDoc:https://apidoc.gitee.com/xchao/j-im/</p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">重点</span>特点</h1>1、高性能(单机可支持几十万至百万人<span style="color: black;">同期</span>在线)
2、轻量、可扩展性极强
3、支持集群多机<span style="color: black;">安排</span>
4、支持SSL/TLS加密传输
5、<span style="color: black;">信息</span>格式极其简洁(JSON)
6、支持多种协议(Socket自定义IM协议、Websocket、Http),可分别独立<span style="color: black;">安排</span>。
7、内置<span style="color: black;">信息</span>持久化(离线、历史、漫游),<span style="color: black;">保准</span>消息<span style="color: black;">靠谱</span>性,高性能存储
8、<span style="color: black;">各样</span>丰富的API接口。
9、零成本<span style="color: black;">安排</span>,一键<span style="color: black;">起步</span>。<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">信息</span>格式</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">1.聊天请求<span style="color: black;">信息</span>结构</strong></p>{
"from": "<span style="color: black;">源自</span>ID",
"to": "<span style="color: black;">目的</span>ID",
"cmd":"命令码(11)int类型",
"createTime": "<span style="color: black;">信息</span>创建时间long类型",
"msgType": "<span style="color: black;">信息</span>类型int类型(0:text、1:image、2:voice、3:vedio、4:music、5:news)",
"chatType":"聊天类型int类型(0:未知,1:公聊,2:私聊)",
"group_id":"群组id仅在chatType为(1)时需要,String类型",
"content": "内容",
"extras" : "扩展字段,JSON对象格式如:{扩展字段名<span style="color: black;">叫作</span>:扩展字段value}"
}<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">请求:COMMAND_CHAT_REQ(11) 响应:COMMAND_CHAT_RESP(12)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">2.鉴权请求<span style="color: black;">信息</span>结构</strong></p>{
"cmd":"命令码(3)int类型",
"token": "校验码"
}
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">请求:COMMAND_AUTH_REQ(3) 响应:COMMAND_AUTH_RESP(4)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">3.握手请求<span style="color: black;">信息</span>结构</strong></p>{
"cmd":"命令码(1)int类型",
"hbyte":"握手1个字节"
}
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">说明:请求:COMMAND_HANDSHAKE_REQ(1) 响应:COMMAND_HANDSHAKE_RESP(2)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">4.登录请求<span style="color: black;">信息</span>结构</strong></p>{
"cmd":"命令码(5)int类型",
"loginname": "用户名",
"password": "<span style="color: black;">秘码</span>",
"token": "校验码(此字段可与logingname、password共存,<span style="color: black;">亦</span>可只选一种方式)"
}<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">请求:COMMAND_LOGIN_REQ(5) 响应:COMMAND_LOGIN_RESP(6)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">5.心跳请求<span style="color: black;">信息</span>结构</strong></p>{
"cmd":"命令码(13)int类型",
"hbbyte":"心跳1个字节"
}
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">请求:COMMAND_HEARTBEAT_REQ(13) 响应:COMMAND_HEARTBEAT_REQ(13)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">6.关闭、退出请求<span style="color: black;">信息</span>结构</strong></p>{
"cmd":"命令码(14)int类型",
"userid":"用户id"
}
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">请求:COMMAND_CLOSE_REQ(14) 响应:无</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">7.获取用户信息请求<span style="color: black;">信息</span>结构</strong></p>{
"cmd":"命令码(17)int类型",
"userid":"用户id(必填项)",
"type":"获取类型(0:所有在线用户,1:所有离线线用户,2:所有用户[在线+离线])"
}
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">请求:COMMAND_GET_USER_REQ(17) 响应:COMMAND_GET_USER_RESP(18)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">8.获取用户<span style="color: black;">信息</span>请求结构</strong></p>{
"cmd":"命令码(19)int类型",
"fromUserId":"<span style="color: black;">信息</span>发送用户id(此字段必须与userId<span style="color: black;">一块</span><span style="color: black;">运用</span>,获取双方聊天<span style="color: black;">信息</span>),非必填",
"userId":"当前用户id(必填字段),当<span style="color: black;">仅有</span>此字段时,type必须为0,意思是获取当前用户所有离线<span style="color: black;">信息</span>(好友+群组)",
"groupId":"群组id(此字段必须与userId<span style="color: black;">一块</span><span style="color: black;">运用</span>,获取当前用户指定群组聊天<span style="color: black;">信息</span>),非必填",
"beginTime":"<span style="color: black;">信息</span>区间<span style="color: black;">起始</span>时间Date毫秒数double类型,非必填",
"endTime":"<span style="color: black;">信息</span>区间结束时间Date毫秒数double类型,非必填",
"offset":"分页偏移量int类型,类似Limit 0,10 中的0,非必填",
"count":"<span style="color: black;">表示</span><span style="color: black;">信息</span>数量,类似Limit 0,10 中的10,非必填",
"type":"<span style="color: black;">信息</span>类型(0:离线<span style="color: black;">信息</span>,1:历史<span style="color: black;">信息</span>)"
}<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">请求:COMMAND_GET_MESSAGE_REQ(19) 响应:COMMAND_GET_MESSAGE_RESP(20)</p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">性能</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">极其震撼的性能,那个每秒发送 500万条聊天<span style="color: black;">信息</span>,单机支持几十万人<span style="color: black;">同期</span>在线的测试当年<span style="color: black;">导致</span>了<span style="color: black;">极重</span>争议,<span style="color: black;">瞧瞧</span> t-io 用户的一则测试报告吧: t-io 30W长连接并发压力测试报告:</p>https://my.oschina.net/u/2369298/blog/915435
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">运用</span></h1>引入 j-im (快速<span style="color: black;">研发</span>自己的高性能 IM 服务器),在你的 pom.xml 中加入如下代码片段<dependency>
<groupId>org.j-im</groupId>
<artifactId>jim-server</artifactId>
<version>2.6.0.v20190114-RELEASE</version>
</dependency><h1 style="color: black; text-align: left; margin-bottom: 10px;">J-IM<span style="color: black;">有些</span>截图</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">Web <span style="color: black;">拜访</span><span style="color: black;">位置</span>:http://localhost:8888</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/ca0b69f07d92428588ad4e65829b93e1~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1724866233&x-signature=FTLBOmr8LAt8q24KFfECHaAg28s%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">Http 协议api 调用<span style="color: black;">位置</span>:</p>http://localhost:8888/api/message/send
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/be8dad4fd9514ea286abdd12eb9a8e0d~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1724866233&x-signature=YNVtTpUZygaRQszAVkb3MLf4Ohs%3D" style="width: 50%; margin-bottom: 20px;"></div>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/0a167f41f8b747c3a78457e175f336fb~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1724866233&x-signature=wI4IcUaCvzH8NhMIY2ywK1j1WPM%3D" style="width: 50%; margin-bottom: 20px;"></div>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">项目<span style="color: black;">位置</span></h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">https://gitee.com/xchao/j-im</p>
</div>
你的见解独到,让我受益匪浅,非常感谢。
页:
[1]