preface

At present, I am in charge of the development of an office App, which provides users with functions such as online chat, audio and video call, file transfer, office mini program container and so on, as well as three platform device clients such as PC, Pad and Phone. RDS need to provide basic IM communication, IM message end-to-end encryption, OSS file storage and upload and download management, user permission control and other functions.

This will be a large development project in terms of functional complexity, so the architectural design will be very important for the iteration of the project, both the maintainability of business functions and the low coupling of modules.

Outline of architecture

Main service module

The main business module, as can be seen from its name, is a module biased towards business customization.

The page or function in this module is designed more with the business fast implementation in mind. For example: registration login interface, user details display page, third-party library encapsulation configuration, generic module registration and configuration.

When a function grows iteratively and has a certain general business capability, it will be split from the main business module and encapsulated into a separate module for other services. For example: user rights management, network clock tool, HTTP connection management module.

IM module

As an office IM App, IM module is the most important module. In terms of function, this module is divided into two parts: communication data management and UI display.

UI display features: chat session list, chat session customization (input control panel, bubble style customization, etc.), audio and video call interface, etc.

The functions of communication data management are: IM connection status management, IM message receiving and receiving management, signaling management, database management and so on.

OSS and file management module

The IM module provides file transfer functions for IM. Because of the universality of OSS upload, download and local file management, this module is separately installed.

This module provides local file storage, download progress management, breakpoint continuation, fragment upload and other OSS functions.

End-to-end encryption capability module

Use encryption algorithms such as DH, AES, and RSA to provide a protocol for setting up a secure channel between two devices through public and private key exchange. At the same time, implement the certificate structure and maintain the device certificate together with the background CA.

This module is a professional function, encapsulating a complete set of end-to-end encryption algorithm implementation.

Identity and permissions module

The main service module maintains user authentication information, such as token validity and basic user information. At the same time, it also maintains the configuration of user rights delivered by the server to manage user rights on the client.

App service configuration module

Manage generic module registration logic, provide priority management, automatic registration and other functions.

Search module

Responsible for services such as homepage search, global or local data search.

Register and manage the search capabilities of different modules to facilitate the use of search functions in different modules.

Note that the search API needs to be implemented asynchronously, and invalid search tasks need to be cancelled when high concurrency occurs, matching only the latest search criteria. For example, when the first search result is not returned, the user searches for 4 consecutive times. If no processing is done, five search results will be generated, among which 2, 3, and 4 are invalid search conditions. After the first search, the user can directly conduct the match of the fifth search.

Hybrid container module

Provide Native capability support for H5, develop small program business, and use H5’s advantages of faster iteration and real-time access to empower App.

Provides the communication capability between Native and JS, provides apis for asynchronous/synchronous communication with JS, and implements registration management for Native functions and JS functions.

Basic Capability module

Log Management Module

Provides log file management, log upload management, and log level management.

Basic function module

Provide tool class, system class method extension and so on.

Network module

HTTP network management, request/response plug-in management.

TCP network management, stick/unpack processing.

Buried point module

According to the service configuration table, it manages the client burial point, manages the data reporting logic, and preprocesses the reported data.

Routing module

Provides the configuration registration function. Routes can be delivered by the server.

Provide App external (such as notifications, web pages) through the URL redirect App page ability.

Provides the ability within the App to jump to a page via a URL, or perform preset functions, to decouple modules.

subsequent

I will continue to publish the design proposals of the modules that I think are important, and I hope to discuss some with you.