Concept Explanation
User Types
In the OpenIM system, users are categorized into three types: Regular User, APP Administrator, and Notification Account.
Regular User
- Components:
userID
,faceURL
,nickname
,ex
- Description: Regular users are typically imported from external business systems and represent the standard terminal users of the OpenIM system. The
ex
field is an extension field for business use.
APP Administrator
- Permissions: Superuser privileges.
- Purpose: The APP Administrator can invoke the REST API to directly operate the OpenIM system.
- Built-in Administrator: The OpenIM server has a built-in APP Administrator with the
userID
of imAdmin.
Notification Account
- Function: APP Administrators can send notification messages as a system notification account, which bypasses friend relationships and group permissions. Notification accounts can be added through the REST API, and their nickname and avatar can be modified.
- User Experience: When users receive messages, the messages will be displayed with the notification account's avatar and nickname in the conversation.
Groups
In the OpenIM system, the group functionality includes the following aspects:
Group Types
- Single Group Type: The current system supports only one type of group, without differentiating between small or large groups.
Group Member Limits
- Member Limit: There is no restriction on the number of group members, with a maximum of 100,000 members supported.
Methods for Joining Groups
Users can join a group through one of the following three methods:
- Group Member Invitation: Existing group members can invite new members to join the group directly.
- Send Join Request: Users must submit a request and wait for approval from the group owner or administrator to join.
- Allow Anyone to Join: Any user can freely join the group without approval.
Group Roles and Permissions
There are three roles in a group, with decreasing levels of permissions:
- Group Owner
- Administrator
- Regular Member
Group Owner
- Permissions: The highest level of permissions.
- Management Functions:
- Set multiple administrators, all of whom have the same permissions.
- Dissolve the group.
- Transfer ownership to another group member.
- Must transfer ownership before leaving the group.
- Handle group join requests.
- Manage group settings, such as group announcements and group name.
Administrator
- Permissions: Same as other administrators, subordinate to the group owner.
- Management Functions:
- Handle group join requests.
- Manage group settings, such as group announcements and group name.
- Perform management tasks on regular members, such as kicking out members or muting them.
Regular Member
- Permissions: Basic group usage permissions.
- Functions: Participate in group chats, view group announcements, send messages, etc.
Permissions Management
- High-Permission Role Operations: Group owners and administrators can perform operations on lower-permission roles, such as kicking members out or muting them.
- Equal Permissions Among Administrators: Administrators have equal permissions and do not have a hierarchical relationship.
Group Owner and Administrator Management Functions
- Handle Join Requests: Group owners and administrators can review and handle user join requests.
- Group Settings Management: Includes editing group announcements, changing group names, etc.
Messages and Notifications
Messages
- Definition: A message refers to the actual content sent by a user or the system, including text, images, videos, and other multimedia forms.
- Functions:
- Content Transmission: Transmits message content to the receiver.
- Display and Presentation: Ensures that the message content is clearly displayed on the receiving end so that the user can understand and view it.
Notifications
- Definition: A notification refers to an action triggered by a user or system and sent to the relevant parties in the form of a notification.
- Uses:
- System Synchronization: Used to synchronize system states or actions, such as group member synchronization or friend list synchronization.
- Information Display: Used to display important events or action results to users, such as join group notifications or system announcements.
Message Push
Online Push
- Definition: When the user is online, OpenIM prioritizes using its own long connection channel for message push. This is called online push.
- Characteristics:
- High Real-time: Messages are delivered to the recipient immediately.
- Stability: Relies on the long connection channel, ensuring message transmission reliability.
Offline Push
- Definition: When the user is offline, or if the app is killed, OpenIM cannot push messages through the long connection and must use a third-party push service.
- Implementation Methods:
- Vendor Push: Uses push services from vendors such as APNs (Apple Push Notification Service) to deliver messages.
- In Mainland China: Generally uses GeTui service.
- Outside China: Generally uses Firebase service.
- Characteristics:
- Wide Coverage: Suitable for various network environments, ensuring that messages are received when the user comes online again.
Message Storage Types
Local Messages
- Apart from the JS SDK, OpenIM stores messages locally as needed. For messages already fetched by the client, the system stores them locally, collectively called "Local Messages" 🗄️.
Multi-Device Sync Messages
- Users often use multiple devices. When a message is sent from device A, it will be synced to device B. These messages are called "Multi-Device Sync Messages" 🔄.
Offline Messages
- Messages received while the user is offline are called "Offline Messages" 📩. The system will sync these messages when the user logs back in.
Roaming Messages
- When the user switches devices or reinstalls the app, the system will fetch and sync these historical messages. These messages are referred to as "Roaming Messages" 🌍.