Core Positioning

The IM module provides built-in instant messaging capabilities for your platform — no need to integrate third-party IM SDKs (such as Huanxin, RongCloud), directly implement private chat, group chat, channel broadcasting, and audio-video calls within your system. Particularly suitable for scenarios requiring “in-platform communication,” such as e-commerce customer service, internal enterprise communication, community private messaging, etc.

In one sentence: Let your users chat within your platform, with data and experience fully under your control.


Problems Solved

Pain PointHow IM Solves It
Third-party IM SDK costs are highSelf-built IM, zero additional cost
User data stored with third partiesChat data in your own database
Need to integrate with business systemsUser system, friend relationships linked with business
Audio-video call capabilityIntegrated with LiveKit, supports WebRTC calls

User Roles

graph LR subgraph Roles IM_USER["Regular User
Private chat/group chat
Send text/images/files/voice
Audio-video calls"] IM_ADMIN["IM Admin
Manage groups
Configure channels
Manage sensitive words
View message records"] end

Functional Architecture

graph TB subgraph Core["Core Features"] MSG2["Message Center
Private/Group chat
Text/Image/File/Voice/Video"] FRIEND["Friend Relationships
Add/Delete/Blocklist"] GROUP["Group Management
Create/Join/Leave/Mute"] CHANNEL["Channel Broadcasting
Announcements/Notifications"] CALL["Audio-Video Calls
Based on LiveKit
WebRTC"] end subgraph Auxiliary EMOJI["Emoji Management"] SENSITIVE["Sensitive Word Filtering"] end subgraph Communication["Communication Layer"] WS["WebSocket Real-time Communication
local / redis / rocketmq
/ kafka / rabbitmq"] end Core --> Communication Auxiliary --> Core

Core ER Diagram

erDiagram IM_USER ||--o{ IM_MESSAGE : "Send" IM_USER ||--o{ IM_FRIEND : "Friend Relations" IM_USER ||--o{ IM_GROUP_MEMBER : "Group Members" IM_GROUP ||--o{ IM_GROUP_MEMBER : "Contains" IM_GROUP ||--o{ IM_MESSAGE : "Group Messages" IM_CHANNEL ||--o{ IM_CHANNEL_MESSAGE : "Channel Messages" IM_CHANNEL ||--o{ IM_CHANNEL_MEMBER : "Channel Members" IM_MESSAGE { bigint id PK bigint from_user_id FK "Sender" bigint to_user_id FK "Receiver" bigint group_id FK "Group" tinyint type "Message Type" text content "Message Content" datetime create_time "Send Time" } IM_GROUP { bigint id PK varchar name "Group Name" bigint owner_user_id FK "Group Owner" tinyint status "Status" } IM_CHANNEL { bigint id PK varchar name "Channel Name" tinyint type "Channel Type" }

Database Table Groups

GroupTable CountDescription
Message Center2 tablesMessage records, message conversations
Friend Relations2 tablesFriends, friend requests
Group Management3 tablesGroups, group members, group announcements
Channel Broadcasting3 tablesChannels, channel members, channel messages
Audio-Video Calls2 tablesCall records, call participants
Others4 tablesEmojis, sensitive words, etc.

WebSocket Communication Modes

graph TB subgraph SendMode["Message Send Modes (Switchable)"] LOCAL["local
Standalone Mode
For development/debugging"] REDIS3["redis
Redis Broadcast
Small clusters"] ROCKET2["rocketmq
RocketMQ
High throughput"] KAFKA2["kafka
Kafka
Large scale"] RABBIT2["rabbitmq
RabbitMQ
Enterprise-grade"] end

Application Scenarios

ScenarioUsage
E-commerce Customer ServiceBuyer ↔ Merchant customer service private chat
Enterprise Internal CommunicationEmployee group chat, department channels
Community Private MessagingUser-to-user private chat
Online EducationStudent ↔ Teacher, course group chat + audio-video
Medical ConsultationPatient ↔ Doctor private chat + audio-video consultation
docs