An open API service indexing awesome lists of open source software.

https://github.com/byakkili/b-im

B-IM是基于Netty实现的即时通讯框架
https://github.com/byakkili/b-im

b-im hutool im java netty protobuf spring-boot-starter

Last synced: 5 months ago
JSON representation

B-IM是基于Netty实现的即时通讯框架

Awesome Lists containing this project

README

          














-------------------------------------------------------------------------------

## B-IM 简介
B-IM是用JAVA语言,基于Netty实现的轻量级、高性能的IM即时通讯框架,主要是降低相关API的学习成本,降低即时通讯门槛,提高工作效率,让开发者更专注于业务的开发。

## 主要特色
1、高性能(可支持几十万以上用户同时在线)
2、轻量,拓展性高(提供丰富的API: 会话监听器、命令拦截器、自定义命令、自定义协议...)
3、支持集群部署(默认提供redisson实现)
4、可支持JSON、Protobuf消息格式(默认提供实现,可根据需要自行拓展)

-------------------------------------------------------------------------------

## 包含模块
| 模块 | 介绍 |
|-------------------------|-------------------------------------------------|
| bim-core | 核心包 |
| bim-spring-boot-starter | SpringBoot启动器,让配置更简单 |

-------------------------------------------------------------------------------

## 文档
[参考API](https://apidoc.gitee.com/byakkili/B-IM)

-------------------------------------------------------------------------------

## 安装

### Maven
在项目中的pom.xml的dependencies中加入以下内容:
```xml

com.github.byakkili
bim-core
0.0.3

```

### Gradle
```
compile 'com.github.byakkili:bim-core:0.0.3'
```

### 非Maven项目
点击以下任一链接,下载`bim-core-0.0.3.jar`即可:
- [Maven中央库1](https://repo1.maven.org/maven2/com/github/byakkili/bim-core/0.0.3/)
- [Maven中央库2](http://repo2.maven.org/maven2/com/github/byakkili/bim-core/0.0.3/)

-------------------------------------------------------------------------------

## 使用
###### (可参考src/test/java下的demo)
```java
public class ServerStarter {
public static void main(String[] args) {
BimConfiguration config = new BimConfiguration();
config.setPort(9000); // 端口
config.setReaderTimeout(30); // 读超时30秒
config.setWriterTimeout(30); // 写超时30秒

// 添加协议提供者
config.addProtocolProvider(new WsProtobufProtocolProvider());
config.addProtocolProvider(new TcpProtobufProtocolProvider());

config.addCmdHandler(new TestHandler()); // 添加命令处理器
config.addCmdInterceptor(new TestInterceptor()); // 添加命令拦截器
config.addSessionListener(new TestSessionListener()); // 设置会话监听器

BimNettyServer bimNettyServer = new BimNettyServer(config);

bimNettyServer.start(); // 启动

bimNettyServer.close(); // 关闭
}
}
```

## DEMO
1、下载本工程代码
2、进入目录B-IM\bim-spring-boot-starter\src\test\resources, 修改配置文件application.yml、redisson.yml
3、运行B-IM\bim-spring-boot-starter\src\test\java\com\github\byakkili\bim\demo\JsonApplication.java的main方法
4、双击打开B-IM\bim-spring-boot-starter\src\test\resources\index.html即可(可打开多个窗口进行聊天)