Instant messaging (IM) project based on Go implementation, providing multi-platform SDK

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK

2022-09-02 1 1,570
Resource Number 38020 Last Updated 2025-02-24
¥ 0HKD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

This issue recommends an instant messaging (IM) project based on Go built by a former wechat technical expert——OpenIM。

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图

Open-im is an Open source instant messaging component created by former wechat technical experts. Open-IM includes the IM server and client SDKS, which achieve important features such as high performance, lightweight, and easy to expand. By integrating Open-IM components and privatizing deployment servers, developers can quickly integrate instant messaging and real-time networking capabilities into their applications and ensure the security and privacy of business data.

Advantages of Open-IM

  • Open source permanently free: The code is all open source and permanently free, including the client and the server, built by former wechat technical experts, and invites global technology geeks to participate in the construction.
  • Easy to expand: the server is implemented by golang, the first “everything is a message” communication model, and it is easy to achieve custom messages and extension functions.
  • Professional technical service: Each technical staff assumes the role of technical customer service, strengthens the community, does not mention work orders, and answers in time.
  • High performance: Learn from and optimize the communication architecture, abstract online message, offline message, historical message storage model, hierarchical governance architecture, support cluster deployment.
  • Security: All the code is open source, the server is privatized, and the data is self-controlled. Join the world’s most secure signal end-to-end encryption protocol.
  • Full platform support: Support Andorid, iOS native development, support Flutter, uni-app cross-end development, support small programs, React and other mainstream web front-end technology framework, PC support Electron, Flutter, iOS, uni-app has mature demo can experience. Developers can use Open-IM to replace various IM cloud services on the market, in addition to reducing costs, but also give developers more flexibility and autonomy. Through Open source, we invite global technology geeks to participate in the construction of Open-IM, so that every developer can use the best IM components for free, so that every app has instant messaging capabilities.

Which modules are included in Open-IM

  • client

1. golang implements cross-platform SDK

2. The iOS version SDK generated on the basis of Open-IM-SDK-Core

3. The Android version SDK generated on the basis of Open-IM-SDK-Core

4. Flutter version SDK generated in Open-IM-SDK-iOS, Open-IM-SDK-Android

5. uni-app version SDK generated in Open-IM-SDK-iOS and Open-IM-SDK-Android

6. Based on Open-IM-SDK-iOS development, for developers reference iOS Demo

7. Android Demo based on Open-IM-SDK-Android development

8. A Flutter Demo based on Open-IM-SDK-Flutter

9. uni-app Demo based on Open-IM-SDK-Uniapp

  • server

1. Server side of pure golang implementation

2. docker mirror image:open-im-server

  • back-end management

Including statistical reports, user management and other operation management system:Open-IM-Admin

Client interface

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图1

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图2

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图3

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图4

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图5

Open-IM main function

  • Multiterminal entry

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图6

  • message type

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图7

  • Message function

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图8

  • User data hosting

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图9

  • User relationship hosting

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图10

  • group

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图11

  • data statistics

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图12

Server architecture

overall structure

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图13

The service end consists of the access layer, logical layer, and storage layer. The benefit is that each layer can focus on its own things based on service characteristics, improve system reusability, and reduce the coupling between services.

  • Access layer: Messages are accessed through websocket protocol, and others are accessed through http/https protocol. Messages are high-frequency and core functions, and dual-protocol routing reflects the design idea of separating light from heavy.
  • Logic layer: Implementation of stateless logic services through rpc, easy parallel extension, messages decoupled via MQ.
  • Storage layer: redis storage token and seq; mongodb stores offline messages and periodically deletes data before 14 days (configurable by itself). mysql stores all historical messages and user information. Hierarchical data storage, taking advantage of the features of different storage components.
  • Etcd:Service registration and discovery, and distributed configuration centers.

Message architecture

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图14

Open-IM message model adopts the classic inbox model, and does message alignment through global seq, which brings the simplification of the architecture and reflects the simple and beautiful architecture design concept.

  • The green arrow indicates the process for user A to send A message to user B. When user A sends a message, msg_gateway splits the message and lands the message to MQ. MQ writes the message to different partitions according to userids and returns the message to User A successfully.
  • The blue arrow indicates the process of the server pushing A message to B after A sends a message to B: msg_transfer is achieved through MQ consumer monitoring messages, adding seq corresponding to userId through redis, associating seq with messages and writing to mongodb, and asynchronously writing to mysql. The former is used for offline message storage. For example, when the user is not online or the push fails, the synchronization message is used to back up historical messages for background management or other purposes. After the write succeeds, pusher is called to push the message according to the msg_gateway connected to B (the push may fail due to network fluctuations or because B is not online).
  • The pink arrow indicates B active synchronization and server differential message flow: When the client has any reconnection action (including re-login, network fluctuation, etc.), it will first obtain its own maximum seq on the server, compare the difference with the local seq, and actively pull the difference message to the local through the interface, thus completing the alignment of the local and server messages.

Message sending, message alignment and other logic of interaction with the server are provided for everyone to use through Open-IM-SDK, simplifying the development process.

Client architecture

Client architecture

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图15

The client SDK is responsible for the interaction with the IM server, local data storage and synchronization, and message and event callback. By integrating SDK, developers can develop chat interface UI by themselves, and set event monitoring callback to realize data docking with UI.

The Open – IMSDK is divided into three layers: network layer, logic layer and storage layer. Hierarchical governance, each performing their own duties, to achieve an efficient, stable, and unified client architecture.

  • Network layer: responsible for maintaining websocket connection with the server, disconnecting the network, and receiving message push to ensure that messages and various events can be reached in real time when online. It is responsible for data completion during initial login and reconnection. By comparing the maximum seq between the local seq and the server, it synchronously pulls difference messages or events to ensure that the client and the server reach the final consistent state.
  • Logical layer: For the active invocation interface and the passive triggering of events, interconnect with the network layer and storage layer to achieve business details, and complete the callback between the UI according to logic. For example, to send a message, the SDK provides a message sending and callback interface for the UI, the logical layer calls the storage layer to store local messages, the network layer calls the message, calls the UI successfully or fails, and triggers the session change callback. After receiving messages or events, the network layer sends the messages or events to the logical layer. The logical layer handles the messages or events according to the types of messages or events, such as storing local messages and triggering callbacks for session changes.
  • Storage layer: sqlite lightweight database is used to complete data synchronization between the local and the server, including sessions, messages, events, contacts, groups, etc. The data get interface provided externally is obtained through the local database, so that the local data such as messages can be viewed without network, and the pressure on the server can be effectively relieved. The dual purpose of data synchronization and cache is achieved.

SDK integration process

Instant messaging (IM) project based on Go implementation, providing multi-platform SDK插图16

Open-IM SDK integration is very simple, due to the developer’s private deployment, code, configuration, data are on their own server, there is no need to apply for AppKey and Secret from the cloud platform, compared with third-party IM cloud services, Open-IM is more secure, controllable, and more free.

You can read more on your own.

资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free Source Code Instant messaging (IM) project based on Go implementation, providing multi-platform SDK https://ictcoder.com/instant-messaging-im-project-based-on-go-implementation-providing-multi-platform-sdk/

Share free open-source source code

Q&A
  • 1. Automatic: After making an online payment, click the (Download) link to download the source code; 2. Manual: Contact the seller or the official to check if the template is consistent. Then, place an order and make payment online. The seller ships the goods, and both parties inspect and confirm that there are no issues. ICTcoder will then settle the payment for the seller. Note: Please ensure to place your order and make payment through ICTcoder. If you do not place your order and make payment through ICTcoder, and the seller sends fake source code or encounters any issues, ICTcoder will not assist in resolving them, nor can we guarantee your funds!
View details
  • 1. Default transaction cycle for source code: The seller manually ships the goods within 1-3 days. The amount paid by the user will be held in escrow by ICTcoder until 7 days after the transaction is completed and both parties confirm that there are no issues. ICTcoder will then settle with the seller. In case of any disputes, ICTcoder will have staff to assist in handling until the dispute is resolved or a refund is made! If the buyer places an order and makes payment not through ICTcoder, any issues and disputes have nothing to do with ICTcoder, and ICTcoder will not be responsible for any liabilities!
View details
  • 1. ICTcoder will permanently archive the transaction process between both parties and snapshots of the traded goods to ensure the authenticity, validity, and security of the transaction! 2. ICTcoder cannot guarantee services such as "permanent package updates" and "permanent technical support" after the merchant's commitment. Buyers are advised to identify these services on their own. If necessary, they can contact ICTcoder for assistance; 3. When both website demonstration and image demonstration exist in the source code, and the text descriptions of the website and images are inconsistent, the text description of the image shall prevail as the basis for dispute resolution (excluding special statements or agreements); 4. If there is no statement such as "no legal basis for refund" or similar content, any indication on the product that "once sold, no refunds will be supported" or other similar declarations shall be deemed invalid; 5. Before the buyer places an order and makes payment, the transaction details agreed upon by both parties via WhatsApp or email can also serve as the basis for dispute resolution (in case of any inconsistency between the agreement and the description of the conflict, the agreement shall prevail); 6. Since chat records and email records can serve as the basis for dispute resolution, both parties should only communicate with each other through the contact information left on the system when contacting each other, in order to prevent the other party from denying their own commitments. 7. Although the probability of disputes is low, it is essential to retain important information such as chat records, text messages, and email records, in case a dispute arises, so that ICTcoder can intervene quickly.
View details
  • 1. As a third-party intermediary platform, ICTcoder solely protects transaction security and the rights and interests of both buyers and sellers based on the transaction contract (product description, agreed content before the transaction); 2. For online trading projects not on the ICTcoder platform, any consequences are unrelated to this platform; regardless of the reason why the seller requests an offline transaction, please contact the administrator to report.
View details

Related Source code

ICTcoder Customer Service

24-hour online professional services