# B-IM **Repository Path**: clewm/B-IM ## Basic Information - **Project Name**: B-IM - **Description**: B-IM是基于Netty实现的即时通讯框架 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 15 - **Created**: 2022-10-22 - **Last Updated**: 2022-10-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## 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 1.0.0 ``` ### Gradle ``` compile 'com.github.byakkili:bim-core:1.0.0' ``` ### 非Maven项目 点击以下任一链接,下载`bim-core-1.0.0.jar`即可: - [Maven中央库1](https://repo1.maven.org/maven2/com/github/byakkili/bim-core/1.0.0/) - [Maven中央库2](http://repo2.maven.org/maven2/com/github/byakkili/bim-core/1.0.0/) ------------------------------------------------------------------------------- ## 使用 ###### (可参考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.addCommandHandler(new TestHandler()); // 添加指令处理器 config.addCommandInterceptor(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即可(可打开多个窗口进行聊天)