Project Overview: IM Service
The IM Service project is an advanced messaging system designed to cater to a variety of communication needs. This service supports different types of messaging scenarios including one-on-one messages, group messages, and messages within chat rooms. The system is architected to handle both individual and collective communication efficiently, offering robust support for large groups and demanding usage environments.
Key Features
-
Messaging Support: The IM Service supports three main modes of messaging: direct peer-to-peer messages, group messages, and chat room messages. This ensures versatility in communication, accommodating personal, collaborative, and community interactions.
-
Scalable Architecture: Built with scalability in mind, the IM Service allows for cluster deployment, enabling it to handle increased loads by distributing resources and processes across multiple servers.
-
High Capacity and Efficiency: On a single server setup, the system can support up to 500,000 online users. Additionally, it can process 5,000 messages per second, ensuring a prompt and smooth messaging experience even during peak times.
-
Large Group Support: The service can manage super-large groups containing up to 3,000 members, facilitating extensive group communication without compromising performance.
Server Requirements
The system is designed to function optimally on server hardware equipped with 32GB of RAM and a 16-core processor. This setup ensures the service maintains high performance levels while handling large volumes of data and user activity.
Compilation and Setup Guide
Step 1: Install Go Language Environment
Ensure that your Go programming language environment supports modules and is version 1.11 or higher. You can find installation details at the official Go documentation.
Step 2: Download the IM Service Code
To obtain the code, execute the following command:
git clone https://github.com/GoBelieveIO/im_service.git
Step 3: Compile the Code
Navigate to the im_service
directory and run:
cd im_service
mkdir bin
make install
This will compile the program, placing the executable files in the bin
directory.
Step 4: Install and Configure Database
Install MySQL and Redis, then import the db.sql
file to set up the necessary database structure.
Step 5: Configure the Program
Configuration details can be found in the sample configuration files ims.cfg.sample
, imr.cfg.sample
, and im.cfg.sample
.
Step 6: Initialize and Launch the Service
- Create directories for storing messages and logs as specified in the configuration files.
- Start the service using the following terminal commands:
mkdir /tmp/im mkdir /tmp/impending mkdir /data/logs/ims mkdir /data/logs/imr mkdir /data/logs/im pushd `dirname $0` > /dev/null BASEDIR=`pwd` nohup $BASEDIR/ims ims.cfg >/data/logs/ims/ims.err 2>&1 & nohup $BASEDIR/imr imr.cfg >/data/logs/imr/imr.err 2>&1 & nohup $BASEDIR/im im.cfg >/data/logs/im/im.err 2>&1 &
Token Configuration
For client connections to the IM server, tokens are stored in Redis hash objects. If testing outside of the API server environment, tokens can be manually generated. The access token structure includes user and application IDs, providing a secure mechanism for client-server communication.
Community and Resources
For further support and community interaction, users are encouraged to join the official QQ groups. The first group (450359487) is full, but the second group (416969931) has availability. When joining, please include a short introduction message.
Explore more about IM Service and related products on the official websites:
- Developer Site: https://developer.gobelieve.io/
- Related Products: https://goubuli.mobi/
This project presents a robust and scalable solution for diverse communication needs, making it an ideal choice for apps that require high performance and reliable messaging capabilities.