[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-4134":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":34,"discoverSource":35},4134,"cim","crossoverJie\u002Fcim","crossoverJie","📲cim(cross IM) 适用于开发者的分布式即时通讯系统","https:\u002F\u002Fcrossoverjie.top\u002Fcategories\u002FNetty\u002F",null,"Java",9489,2872,385,37,0,2,5,11,7,41,"MIT License",false,"master",true,[27,28,29,30],"heartbeat","im","netty","tcp","2026-06-12 02:00:59","\n\n\n\u003Cdiv align=\"center\">\n\n\u003Cimg src=\"https:\u002F\u002Fi.loli.net\u002F2020\u002F02\u002F21\u002FrfOGvKlTcHCmM92.png\"  \u002F>\n\u003Cbr\u002F>\n\n[![codecov](https:\u002F\u002Fcodecov.io\u002Fgh\u002FcrossoverJie\u002Fcim\u002Fgraph\u002Fbadge.svg?token=oW5Gd1oKmf)](https:\u002F\u002Fcodecov.io\u002Fgh\u002FcrossoverJie\u002Fcim)\n[![Build Status](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcim-cross--im-brightgreen.svg)](https:\u002F\u002Fgithub.com\u002FcrossoverJie\u002Fcim)\n[![](https:\u002F\u002Fbadge.juejin.im\u002Fentry\u002F5c2c000e6fb9a049f5713e26\u002Flikes.svg?style=flat-square)](https:\u002F\u002Fjuejin.im\u002Fpost\u002F5c2bffdc51882509181395d7)\n\n📘[Introduction](#introduction) |📽[Video Demo](#video-demo) | 🏖[TODO LIST](#todo-list) | 🌈[Architecture](#architecture) |💡[Flow Chart](#flow-chart)|🌁[Quick Start](#quick-start)|👨🏻‍✈️[Built-in Commands](#built-in-commands)|🎤[Chat](#group-chatprivate-chat)|❓[QA](https:\u002F\u002Fgithub.com\u002FcrossoverJie\u002Fcim\u002Fblob\u002Fmaster\u002Fdoc\u002FQA.md)|💌[Contact](#contact)\n\n[中文文档](README-zh.md)\n\n\u003C\u002Fdiv>\n\u003Cbr\u002F>\n\n# V2.0\n- [x] Upgrade to JDK17 & springboot3.0\n- [x] Client SDK\n- [ ] Client use [picocli](https:\u002F\u002Fpicocli.info\u002F) instead of springboot.\n- [x] Support integration testing.\n- [ ] Integrate OpenTelemetry .\n- [ ] Support single node startup(Contains no components).\n- [ ] Third-party components support replacement(Redis\u002FZookeeper, etc.).\n- [ ] Support web client(websocket).\n- [x] Support docker container.\n- [ ] Support kubernetes operation.\n- [ ] Supports binary client(build with golang).\n\n## Introduction\n\n`CIM(CROSS-IM)` is an `IM (instant messaging)` system for developers; it also provides some components to help developers build their own scalable `IM`.\nUsing `CIM`, you can achieve the following requirements:\n- `IM` instant messaging system.\n- Message push middleware for `APP`.\n- Message middleware for `IOT` massive connection scenarios.\n\n> If you have any questions during use or development, you can [contact the author](#contact).\n\n## Video Demo\n\n> Click the links below to watch the video demo.\n\n| YouTube | Bilibili|\n| :------:| :------: |\n| [Group Chat](https:\u002F\u002Fyoutu.be\u002F_9a4lIkQ5_o) [Private Chat](https:\u002F\u002Fyoutu.be\u002FkfEfQFPLBTQ) | [Group Chat](https:\u002F\u002Fwww.bilibili.com\u002Fvideo\u002Fav39405501) [Private Chat](https:\u002F\u002Fwww.bilibili.com\u002Fvideo\u002Fav39405821) |\n| \u003Cimg src=\"https:\u002F\u002Fi.loli.net\u002F\u002F2019\u002F\u002F05\u002F\u002F08\u002F\u002F5cd1d9e788004.jpg\"  height=\"295px\" \u002F>  | \u003Cimg src=\"https:\u002F\u002Fi.loli.net\u002F\u002F2019\u002F\u002F05\u002F\u002F08\u002F\u002F5cd1da2f943c5.jpg\" height=\"295px\" \u002F>\n\n![demo.gif](pic\u002Fdemo.gif)\n\n## TODO LIST\n\n* [x] [Group Chat](#group-chat)\n* [x] [Private Chat](#private-chat)\n* [x] [Built-in Commands](#built-in-commands)\n* [x] [Chat History Query](#chat-history-query)\n* [x] [AI Mode](#ai-mode)\n* [x] Efficient encoding\u002Fdecoding with `Google Protocol Buffer`\n* [x] Flexible horizontal scaling based on actual needs\n* [x] Server-side automatic removal of offline clients\n* [x] Client automatic reconnection\n* [x] [Delayed Messages](#delayed-messages)\n* [x] SDK development package\n* [ ] Group categorization\n* [ ] Offline messages\n* [ ] Message encryption\n\n\n\n## Architecture\n\n![](pic\u002Farchitecture.png)\n\n- Each component in `CIM` is built using `SpringBoot`\n  - Client build with [cim-client-sdk](https:\u002F\u002Fgithub.com\u002FcrossoverJie\u002Fcim\u002Ftree\u002Fmaster\u002Fcim-client-sdk)\n- Use `Netty` to build the underlying communication.\n- `MetaStore` is used for registration and discovery of `IM-server` services.\n\n\n### cim-server\nIM server is used to receive client connections, message forwarding, message push, etc.\nSupport cluster deployment.\n\n### cim-route\n\nRoute server; used to process message routing, message forwarding, user login, user offline, and some operation tools (get the number of online users, etc.).\n\n### cim-client\nIM client terminal, a command can be started and initiated to communicate with others (group chat, private chat).\n\n## Flow Chart\n\n![](https:\u002F\u002Fs2.loli.net\u002F2024\u002F10\u002F13\u002F8teMn7BSa5VWuvi.png)\n\n- Server register to `MetaStore`\n- Route subscribe `MetaStore`\n- Client login to Route\n  - Route get Server info from `MetaStore`\n- Client open connection to Server\n- Client1 send message to Route\n- Route select Server and forward message to Server\n- Server push message to Client2\n\n\n## Quick Start\n\n### Docker\n\nThe `allin1` image comes with Zookeeper, Redis, cim-server, and cim-forward-route pre-installed, all managed by [Supervisor](http:\u002F\u002Fsupervisord.org\u002F) for an out-of-the-box experience.\n\n**Supported platforms:** linux\u002Famd64, linux\u002Farm64, linux\u002Farm\u002Fv7\n\n**Port mapping:**\n\n| Port | Service | Description |\n|------|---------|-------------|\n| 2181 | Zookeeper | Service registration & discovery |\n| 6379 | Redis | Data caching |\n| 8083 | Route Server | HTTP API routing service |\n\nPull the image and start the container:\n\n```shell\ndocker pull ghcr.io\u002Fcrossoverjie\u002Fallin1-ubuntu:latest\ndocker run -p 2181:2181 -p 6379:6379 -p 8083:8083 --rm --name cim-allin1 ghcr.io\u002Fcrossoverjie\u002Fallin1-ubuntu:latest\n```\n\nAfter the container starts, refer to the [Register Account](#register-account) and [Start Client](#start-client) sections below to experience the full IM workflow.\n\n### Build Docker Image Locally\n\nTo build the Docker image from source:\n\n```shell\n# Run from the project root directory\ndocker build -t cim-allin1:latest -f docker\u002Fallin1-ubuntu.Dockerfile .\ndocker run -p 2181:2181 -p 6379:6379 -p 8083:8083 --rm --name cim-allin1 cim-allin1:latest\n```\n\n### Build from Source\n\nFirst, install `Zookeeper` and `Redis` and ensure the network is accessible.\n\n```shell\ndocker run --rm --name zookeeper -d -p 2181:2181 zookeeper:3.9.2\ndocker run --rm --name redis -d -p 6379:6379 redis:7.4.0\n```\n\n```shell\ngit clone https:\u002F\u002Fgithub.com\u002FcrossoverJie\u002Fcim.git\ncd cim\nmvn clean install -DskipTests=true\ncd cim-server && cim-client && cim-forward-route\nmvn clean package spring-boot:repackage -DskipTests=true\n```\n\n### Deploy IM-server (cim-server)\n\n```shell\ncp \u002Fcim\u002Fcim-server\u002Ftarget\u002Fcim-server-1.0.0-SNAPSHOT.jar \u002Fxx\u002Fwork\u002Fserver0\u002F\ncd \u002Fxx\u002Fwork\u002Fserver0\u002F\nnohup java -jar  \u002Froot\u002Fwork\u002Fserver0\u002Fcim-server-1.0.0-SNAPSHOT.jar --cim.server.port=9000 --app.zk.addr=\u003Czk-address>  > \u002Froot\u002Fwork\u002Fserver0\u002Flog.file 2>&1 &\n```\n\n> For cim-server cluster deployment, just ensure all instances point to the same Zookeeper address.\n\n### Deploy Route Server (cim-forward-route)\n\n```shell\ncp \u002Fcim\u002Fcim-server\u002Fcim-forward-route\u002Ftarget\u002Fcim-forward-route-1.0.0-SNAPSHOT.jar \u002Fxx\u002Fwork\u002Froute0\u002F\ncd \u002Fxx\u002Fwork\u002Froute0\u002F\nnohup java -jar  \u002Froot\u002Fwork\u002Froute0\u002Fcim-forward-route-1.0.0-SNAPSHOT.jar --app.zk.addr=\u003Czk-address> --spring.redis.host=\u003Credis-address> --spring.redis.port=6379  > \u002Froot\u002Fwork\u002Froute\u002Flog.file 2>&1 &\n```\n\n> cim-forward-route is stateless and can be deployed on multiple nodes; use Nginx as a reverse proxy.\n\n\n### Start Client\n\n```shell\ncp \u002Fcim\u002Fcim-client\u002Ftarget\u002Fcim-client-1.0.0-SNAPSHOT.jar \u002Fxx\u002Fwork\u002Froute0\u002F\ncd \u002Fxx\u002Fwork\u002Froute0\u002F\njava -jar cim-client-1.0.0-SNAPSHOT.jar --server.port=8084 --cim.user.id=\u003Cunique-client-id> --cim.user.userName=\u003Cusername> --cim.route.url=http:\u002F\u002F\u003Croute-server>:8083\u002F\n```\n\n![](https:\u002F\u002Fws2.sinaimg.cn\u002Flarge\u002F006tNbRwly1fylgxjgshfj31vo04m7p9.jpg)\n![](https:\u002F\u002Fws1.sinaimg.cn\u002Flarge\u002F006tNbRwly1fylgxu0x4uj31hy04q75z.jpg)\n\nAs shown above, two clients can communicate with each other.\n\n### Local Client Startup\n\n#### Register Account\n```shell\ncurl -X POST --header 'Content-Type: application\u002Fjson' --header 'Accept: application\u002Fjson' -d '{\n  \"reqNo\": \"1234567890\",\n  \"timeStamp\": 0,\n  \"userName\": \"zhangsan\"\n}' 'http:\u002F\u002F\u003Croute-server>:8083\u002FregisterAccount'\n```\n\nGet the `userId` from the response:\n\n```json\n{\n    \"code\":\"9000\",\n    \"message\":\"success\",\n    \"reqNo\":null,\n    \"dataBody\":{\n        \"userId\":1547028929407,\n        \"userName\":\"test\"\n    }\n}\n```\n\n#### Start Local Client\n```shell\n# Start local client\ncp \u002Fcim\u002Fcim-client\u002Ftarget\u002Fcim-client-1.0.0-SNAPSHOT.jar \u002Fxx\u002Fwork\u002Froute0\u002F\ncd \u002Fxx\u002Fwork\u002Froute0\u002F\njava -jar cim-client-1.0.0-SNAPSHOT.jar --server.port=8084 --cim.user.id=\u003CuserId-from-above> --cim.user.userName=\u003Cusername> --cim.route.url=http:\u002F\u002F\u003Croute-server>:8083\u002F\n```\n\n## Built-in Commands\n\n| Command | Description |\n| ------ | ------ |\n| `:q!` | Quit the client |\n| `:olu` | List all online users |\n| `:all` | Show all available commands |\n| `:q [keyword]` | Search chat history by keyword |\n| `:ai` | Enable AI mode |\n| `:qai` | Disable AI mode |\n| `:pu` | Fuzzy search users |\n| `:info` | Show client information |\n| `:emoji [option]` | Browse emoji list [option: page number] |\n| `:delay [msg] [delayTime]` | Send a delayed message |\n| `:` | More commands are under development... |\n\n![](https:\u002F\u002Fws3.sinaimg.cn\u002Flarge\u002F006tNbRwly1fylh7bdlo6g30go01shdt.gif)\n\n### Chat History Query\n\n![](https:\u002F\u002Fi.loli.net\u002F2019\u002F05\u002F08\u002F5cd1c310cb796.jpg)\n\nUse the command `:q keyword` to search chat history related to you.\n\n> Client chat history is stored in `\u002Fopt\u002Flogs\u002Fcim\u002F` by default, so write permission is required for this directory. You can also customize the directory by adding `--cim.msg.logger.path=\u002Fcustom\u002Fpath` to the startup command.\n\n\n\n### AI Mode\n\n![](https:\u002F\u002Fi.loli.net\u002F2019\u002F05\u002F08\u002F5cd1c30e47d95.jpg)\n\nUse the command `:ai` to enable AI mode. After that, all messages will be responded to by `AI`.\n\nUse `:qai` to exit AI mode.\n\n### Prefix Match Username\n\n![](https:\u002F\u002Fi.loli.net\u002F2019\u002F05\u002F08\u002F5cd1c32ac3397.jpg)\n\nUse the command `:qu prefix` to search user information by prefix.\n\n> This feature is primarily designed for searching users in input fields on mobile clients.\n\n### Group Chat\u002FPrivate Chat\n\n#### Group Chat\n\n![](https:\u002F\u002Fws1.sinaimg.cn\u002Flarge\u002F006tNbRwly1fyli54e8e1j31t0056x11.jpg)\n![](https:\u002F\u002Fws3.sinaimg.cn\u002Flarge\u002F006tNbRwly1fyli5yyspmj31im06atb8.jpg)\n![](https:\u002F\u002Fws3.sinaimg.cn\u002Flarge\u002F006tNbRwly1fyli6sn3c8j31ss06qmzq.jpg)\n\nFor group chat, simply type a message in the console and press Enter to send. All online clients will receive the message.\n\n#### Private Chat\n\nTo send a private message, you need to know the recipient's `userID`.\n\nUse the command `:olu` to list all online users.\n\n![](https:\u002F\u002Fws4.sinaimg.cn\u002Flarge\u002F006tNbRwly1fyli98mlf3j31ta06mwhv.jpg)\n\nThen use the format `userId;;message content` to send a private message.\n\n![](https:\u002F\u002Fws4.sinaimg.cn\u002Flarge\u002F006tNbRwly1fylib08qlnj31sk082zo6.jpg)\n![](https:\u002F\u002Fws1.sinaimg.cn\u002Flarge\u002F006tNbRwly1fylibc13etj31wa0564lp.jpg)\n![](https:\u002F\u002Fws3.sinaimg.cn\u002Flarge\u002F006tNbRwly1fylicmjj6cj31wg07c4qp.jpg)\n![](https:\u002F\u002Fws1.sinaimg.cn\u002Flarge\u002F006tNbRwly1fylicwhe04j31ua03ejsv.jpg)\n\nMeanwhile, the other account will not receive the message.\n![](https:\u002F\u002Fws3.sinaimg.cn\u002Flarge\u002F006tNbRwly1fylie727jaj31t20dq1ky.jpg)\n\n\n\n### Emoji Support\n\nUse the command `:emoji 1` to list all available emojis. Use the emoji alias to send an emoji.\n\n![](https:\u002F\u002Ftva1.sinaimg.cn\u002Flarge\u002F006y8mN6ly1g6j910cqrzj30dn05qjw9.jpg)\n![](https:\u002F\u002Ftva1.sinaimg.cn\u002Flarge\u002F006y8mN6ly1g6j99hazg6j30ax03hq35.jpg)\n\n### Delayed Messages\n\nSend a message with a 10-second delay:\n\n```shell\n:delay delayMsg 10\n```\n\n![](pic\u002Fdelay.gif)\n\n## Contact\n\n## Contributing\n\nWe welcome contributions! Before submitting a PR, please ensure your code passes the Checkstyle check.\n\n### Code Style\n\nThis project uses [Checkstyle](https:\u002F\u002Fcheckstyle.org\u002F) to enforce code style. The rules are defined in `checkstyle\u002Fcheckstyle.xml`.\n\n**Run Checkstyle locally before committing:**\n\n```shell\nmvn checkstyle:check\n```\n\n**Key rules:**\n- Use spaces around `{`, `}`, and operators\n- No trailing whitespace\n- Files must end with a newline\n- Remove unused imports\n- Constants (`static final`) must be `UPPER_SNAKE_CASE`\n- Use Java-style array declarations: `String[] args` (not `String args[]`)\n\n**Skip Checkstyle for quick builds:**\n\n```shell\nmvn package -Dcheckstyle.skip=true\n```\n\n- [crossoverJie@gmail.com](mailto:crossoverJie@gmail.com)\n","cim(cross IM) 是一个为开发者设计的分布式即时通讯系统。该项目基于Java语言开发，利用Netty框架实现高性能的TCP通信，并通过心跳机制确保连接稳定。它支持群聊、私聊及消息推送等功能，采用Google Protocol Buffer进行高效编码解码，具备灵活的水平扩展能力。此外，cim还提供了客户端SDK，方便集成到不同应用中。适用于需要构建大规模即时通讯平台的应用场景，如社交软件、企业内部沟通工具或物联网设备间的通信解决方案等。","2026-06-11 02:58:38","top_language"]