easy-im是面向开发者的一款轻量级、开箱即用的即时通讯系统,帮助开发者快速搭建消息推送等功能。 基于easy-im,你可以快速实现以下功能:
+ 聊天软件
+ IoT消息推送
项目分为easy-im-client、easy-im-server、easy-im-common三个模块。
服务端:
执行mvn package后生成easy-im-server.tar.gz,解压后至./lib目录执行命令:
java -jar -Dport=8888 easy-im-server-1.0-SNAPSHOT.jar,即可启动服务端,其中port是服务端口。
客户端:
执行mvn package后生成easy-im-client.tar.gz,解压后至./lib目录执行命令:
java -jar -Duserid=110 -Dusername=zhangsan -Dhost=127.0.0.1 -Dport=8888 easy-im-client-1.0-SNAPSHOT.jar。
其中userid为用户id,username为用户名,host为服务端ip,port为服务端端口,其中userid要保持唯一性。
用法:
客户端启动后,在命令行输入命令,命令格式为 command::content ,命令以英文双冒号为分隔符,现已支持如下命令:
+ 单聊 sendToUser::userId::msg
+ 群聊 sendToGroup::groupId::msg
+ 发起群聊 createGroup::userId1,userId2,userId3...
+ 广播 broadcast::msg
后续计划加入更多命令,如:
+ 退出群聊 quitGroup::groupId
+ 加入群聊 joinGroup::groupId
+ 查询所有在线用户 getAllUsers
+ 查询群聊中在线用户 getGroupUsers::groupId
3. client之间互聊时,需发送消息至route,route到redis中查找对应的server,再将消息通过server转发至对方的client,以实现两个client不在同一台server时互聊
目前集群版(v2分支)正在计划中,欢迎有兴趣的同学共同参与,共同进步。
- [email protected]
- 个人微信号
- 微信公众号