Communication method based on public component authentication

By embedding public components with user system and data synchronization functions in two independent programs, the problems of high cost of data communication between software and complex docking are solved, and efficient and low-cost data synchronization is achieved.

CN119512775APending Publication Date: 2025-02-25路九阳
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411387633.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-06
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

In the prior art, data communication between software is costly and highly dependent, and differences in technical architecture, data format, communication protocols and other differences between different software lead to complex docking.

Method used

By embedding common components in two independent programs, the public components have user system, login module, communication module, and data synchronization module to realize data communication and synchronization between the two programs.

Benefits of technology

There is no need to write complex data synchronization code, the development efficiency is greatly improved, and the development cost is extremely low, achieving data synchronization between the two programs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512775A_ABST
    Figure CN119512775A_ABST
Patent Text Reader

Abstract

The invention provides a communication method based on public component authentication, which is used for realizing data sharing and data communication between programs, and belongs to the technical field of communication, and specifically comprises the following steps: embedding public components of the same type into different programs, the components at least comprise a login module, a network module, a data synchronization module and component data, and when a host program is started, the login module is connected with the network module; the data synchronization module logs in the public component, authenticates the user and establishes communication connection between the public components which are logged in by the same user, and the data synchronization module executes data synchronization processing between the public components which are authenticated by the data synchronization module when the data synchronization module monitors that the data of the component changes. And thus, the component data contained in the public components with the same login authentication are kept consistent. Visibly, according to the method provided by the invention, automatic data synchronization is realized on the basis of same authentication of the public components, and when data synchronization needs to be realized between programs, only the public components need to be embedded respectively and login is carried out with the same user information, so that complex data synchronization programming work is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of communication technology, and in particular to a communication method based on public component authentication. Background Art

[0002] There are many ways to synchronize data and communicate between two software, such as: API interface, application program interface (API) allows software to communicate and exchange data in a standard way; database sharing, two software can access the same database to share data; file transfer, through file transfer protocol (such as FTP, SFTP, etc.) or shared storage; message queue, message queue allows software to communicate by sending and receiving messages; socket communication, through socket programming, software can establish a network connection and exchange data on the connection.

[0003] Analysis of the above existing methods for implementing data communication between software shows that they all require investment in software development manpower, have high implementation costs, and are highly dependent. In addition, differences in technical architecture, data format, communication protocol, and other aspects between different software make the docking process relatively complicated.

[0004] According to the problems existing in the data communication between software in the above prior art, it is urgent to develop new technologies to solve them. Summary of the invention

[0005] As we all know, data is the basis for software operation, communication is a basic function of software, and data sharing and data communication are common requirements in software development. For example, a user logs in and uses WeChat software on a PC. When the user uses the same WeChat account to log in and use WeChat on a mobile phone, he hopes to obtain historical data under PC WeChat, including friends, chat records, etc. Although the existing WeChat software already includes the above functions, it is undeniable that the WeChat development team needs to develop a dedicated data synchronization module, which requires considerable development manpower. For another example, when a user surfs the Internet through browser A, searching and visiting web pages generates search records, access history and other data. When a user surfs the Internet using browser B on a mobile device, he wants to obtain relevant data under browser A under browser B. The browser developer also needs to develop corresponding synchronization functions for the above data, which also requires considerable development manpower.

[0006] As mentioned above, the need for data synchronization between programs is very common, therefore, the present application provides a new method to solve the data sharing and communication problem between two independent programs.

[0007] First, the implementation principle of this application is explained by analogy. Please refer to Figure 2, container A and container B contain liquids of different heights respectively. If the liquid levels therein need to be synchronized, the usual practice is to establish a pipeline 1 between container A and container B. This application proposes to use a pipeline 2 to achieve synchronization, wherein container C itself has the ability to circulate liquid and maintain synchronization. Container C is placed in container A and container B respectively, and the ability of container C is used to achieve liquid circulation between container A and container B to make the liquid levels the same. From the above analysis, it is not difficult to see that establishing a pipeline 1 between container A and container B requires the modification of container A and container B, and the cost is obviously greater than using the synchronization ability of container C.

[0008] According to the above principle. Figure 1 As shown, the first program and the second program are two independent programs, and there is a need for data synchronization. The implementation method of the present application is: embedding a common component 103 in both programs at the same time. The common component 103 is a special program component, which has its own user system or authentication mechanism, and at least includes a login module, a communication module, a data synchronization module, and component data. The common component 103 can be embedded in the host program for operation. It is logically a complete and independent operating unit, which has its own independent operating environment, variables and operating data. It is important that the common component 103 has an independent user system. When embedded in different host programs, the common components 103 logged in by the same user are regarded as brother components. The communication module contained in each common component 103 is used to establish data communication between the common component 103 and its brother components, including two ways of directly establishing communication between the two common components or indirectly establishing communication through an intermediate server. When the data synchronization module monitors that the component data in this component has changed, the data synchronization function is started to synchronize the component data to the intermediate server or the data synchronization module of the common component 103, so that the component data contained in each brother component in operation remains consistent.

[0009] The above method can be simply understood as designing and developing a common component, which is a logically independent running unit and includes functions such as user login, data communication, and data synchronization. The common component is embedded in the host program and runs. When it is loaded and run, it automatically establishes data communication with its brother components after login, and performs data synchronization between its brother components to keep the component data in each brother component consistent. It can be seen that because the common component has its own data synchronization function, data synchronization can be achieved between host programs that include it with the help of the capabilities of the common component.

[0010] According to the above implementation method, it is not difficult to see that when the common component 103 is a universal component, the above implementation method basically does not need to be developed and implemented. The beneficial effect obtained is that for programs A and B with data synchronization requirements, the common component is embedded in them respectively, and the same user authentication is provided to the common component during operation, so that the data synchronization of programs A and B can be quickly realized without writing complex data synchronization code, which greatly improves the development efficiency and reduces the development cost.

[0011] In one possible implementation, corresponding common component program versions are provided for different operating environments for embedding in different types of host programs. It should be noted that each type of program version has the same user authentication and functions, and the data structure of the component data in each program version is exactly the same, and the embedded program version of the common component is compatible with its host program. The above implementation makes it possible to directly and quickly synchronize data between programs running in different programming languages ​​or in different environments.

[0012] In a possible implementation, the common component provides methods and properties that can be accessed externally, the methods can be called by the host program of the common component, and the properties can be read and set by the host program of the common component. In this implementation, the methods provided by the common component can be called by its host program, so that the host program can use the functions contained in the component, set or obtain component properties, obtain component running status, etc. For example, the common component at least provides a method for logging in and authenticating the common component, which is essentially a method that can be accessed externally.

[0013] In a possible implementation, a common component is respectively embedded in a first program and a second program to achieve data synchronization between the two programs, and the first program and the second program set the component data of the common component they contain, including the following methods: the common component provides a method for setting component data that can be accessed by the host program, and the first program and the second program call the method to obtain and set the component data. Another method is that the common component provides component data or data members in the component data as attributes, and the first program and the second program set the component data by reading and setting the attributes.

[0014] In a possible implementation, the data in the component data includes public data and private data, wherein the public data is synchronized with the public components authenticated by the same user, and the private data is data privately operated and stored between public components, and data synchronization is not performed between public components authenticated by the same user. Through this implementation, in the component data, all data used to synchronize with other public components are set as public data, and data that is only accessed and processed by the public component itself and synchronized with other public components is set as private data. Therefore, the automatic synchronization requirements of data between two programs are met, while the privatized operation of the public component, user privacy protection, etc. are met. Optionally, the data in the component data is set to public data by default. Optionally, the data in the component data is set to private data by default.

[0015] In one possible implementation, a common component is embedded in the first program or the second program and data synchronization is implemented based on the same user authentication of the component. When the common component completes the component data update, the execution of the first function is triggered, wherein the first function is registered in the common component and the call to the function is implemented, and the execution content of the first function is defined by the host program of the common component. This implementation is essentially the concept of a callback function. After the data synchronization is completed, a function associated with the event will be called to handle the event, that is, a certain process is executed after the data synchronization, or a certain process is executed after the synchronized data meets a certain condition, which makes the program more flexible and extensible. Optionally, a callback implementation mechanism is provided in the common component, and the execution content of the callback function is defined in the host program of the common component.

[0016] In a possible implementation, a common component is embedded in the first program or the second program and data synchronization is achieved based on the same user authentication of the component. The common component also includes a control state identifier. At the same time, among the multiple common components based on the same user authentication, only one of the common components has a control state identifier set to a master state, and the other common components are in a controlled state. The common component in the master state has write permission for its component data, and the data synchronization module generates component synchronization data and sends it. The common component in the controlled state has no write permission for its component data, and the data synchronization module receives component synchronization data and writes it. In this implementation, the master state and the controlled state are used to represent the sender and the synchronized party of the component data, and the control state identifier helps to understand the working state of the common component under the current host program. Optionally, in the common component, an external function for setting the control state of the common component is provided. Preferably, when the control state of a common component is set to the master state, the other common components based on the same user authentication of the component are set to the controlled state. It should be noted that the write permission is a permission for a non-data synchronization module in a public component to add, update, and delete its component data.

[0017] In a possible implementation, the public component does not have the authority to access non-public component related resources in its host program. The advantages of this implementation are mainly reflected in security and isolation, which is similar to the sandbox mechanism of a browser. By limiting the authority and access scope of the public component, the risk of the public component causing damage to its host program is reduced, while helping to protect user privacy.

[0018] In a possible implementation, a common component is embedded in the first program or the second program and data synchronization is achieved based on the same user authentication of the component, the common component being a browser component, specifically:

[0019] The browser component is included in both the first program and the second program, wherein the browser component is a browser program based on the same or related user authentication, and the browser components in the first program and the second program at least include a browser module, a communication module, an authentication module, a data synchronization module, and browser data, the browser module is used to perform web browsing, the communication module is used to establish a communication connection between the browser components based on the same or related user authentication in the first program and the second program, the authentication module is used for login authentication, the data synchronization module is used to synchronize the browser data contained between the browser components based on the same or related user authentication, and the browser data is the data of the browser component running operation or the data generated and stored;

[0020] When the first program is started and executed, the browser component is loaded, and the browser component included in the first program is logged in based on the first user information to run; when the second program is started and executed, the browser component is loaded, and the browser component included in the second program is logged in based on the second user information to run; wherein the first user information and the second user information are the same or related user information;

[0021] In the first program, the browser component is run and the browser data is operated to perform browser data synchronization, including: the data synchronization module of the first program synchronizes the browser data from the browser component of the first program to the browser component of the second program or the intermediate server; the data synchronization module of the browser component in the second program obtains the browser data from the first program or the intermediate server, and updates the browser data in the browser component of the second program to keep it synchronized with the browser data in the browser component of the first program.

[0022] According to the above analysis, the public components required by this application must have their own user system or authentication mechanism. Ordinary buttons, dialog boxes and other components obviously do not meet the requirements, and the versatility of customized components is poor. It is difficult to promote a customized component to any developer and any development language. Comprehensively analyzing the above requirements, applying browser components as the public components is a good choice. It should be noted that the existing browser components cannot be directly used for the implementation of this application. Communication modules, authentication modules, data synchronization modules, and browser data need to be added to the existing browser components to meet the requirements of this application for the public components.

[0023] From the above, it can be seen that the communication method based on public component authentication provided in the embodiment of the present application, compared with the traditional data synchronization implementation method, does not need to write data synchronization implementation code. It embeds the public component in the program that needs to perform data synchronization and sets user authentication for it. It is simple to implement, has high development efficiency and good stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 A schematic diagram of the module composition of a communication system based on public component authentication provided in an embodiment of the present application;

[0025] Figure 2 Schematic diagram of two ways of connecting two containers;

[0026] Figure 3 A possible version classification diagram of a common component provided in an embodiment of the present application;

[0027] Figure 4A schematic diagram of a common component structure provided for an embodiment of the present application;

[0028] Figure 5 A schematic diagram of two types of data, synchronous and asynchronous, in a component data provided in an embodiment of the present application;

[0029] Figure 6 A schematic diagram of a judgment and execution flow of a first function provided in an embodiment of the present application;

[0030] Figure 7 A schematic diagram of a control state and synchronization direction provided in an embodiment of the present application;

[0031] Figure 8 A schematic diagram of access rights for a host program and a common component method provided in an embodiment of the present application;

[0032] Fig. 9 A schematic diagram of the structure of a communication system based on browser component authentication provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The implementation mode part of this application is only used to explain this application but is not intended to limit this application.

[0034] The following describes the embodiments of the present application in conjunction with the accompanying drawings. Obviously, the described embodiments are only embodiments of a part of the present application, rather than all embodiments. It is known to those skilled in the art that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0035] As we all know, data transmission and data synchronization between two programs is a common requirement for program development, and existing technologies usually require a lot of development costs to implement. Among them, a common implementation method is that developers write data synchronization programs based on the specific business scenarios of the two programs. For example, the same user logs in to the WeChat program on the mobile phone and PC at the same time. When there is new message data on the server, the two terminals obtain the new message data from the server and display it. The user views the message data through the PC and sets the status of the message to the read status. The status setting needs to send a request to notify the server to set and synchronize to the mobile phone, or the PC directly synchronizes the status setting to the mobile terminal. It is not difficult to see that in the specific operation scenario of the WeChat program, there are many requirements for data synchronization between the above terminal programs, which requires a lot of development and testing costs to implement. Another common implementation method is to synchronize data between two applications by reading and writing the same database based on the database. However, this method will impose a certain burden on the database server each time the database is directly read and written, especially in high-concurrency scenarios. A large number of read and write requests will cause database performance to degrade. In order to increase data access speed, reduce system burden, and reduce network latency, operating the local cache is usually more efficient than directly reading and writing the database. Data synchronization in the local cache undoubtedly requires considerable development costs.

[0036] In response to the above problems, this application provides a communication method based on public component authentication to achieve communication and data synchronization between two programs. First, the implementation principle of this application is explained by analogy. Please refer to Figure 2 As shown in the diagram of the connection method between two containers, container A and container B contain liquids of different heights. To connect the two containers, one method is to directly establish a pipeline between container A and container B, as shown in "Method 1" in the figure; and another method is to place component C with the function of connecting and transmitting liquid into container A and container B at the same time, and transmit liquid by relying on the ability of component C itself, as shown in "Method 2" in the figure. It is not difficult to see that method 2 requires little investment in specific implementation, and developers do not need to pay attention to complex data synchronization business logic.

[0037] refer to Figure 2 The connection principle shown in the figure, this application proposes a communication method based on public component authentication, please refer to Figure 1, the corresponding communication system module composition based on public component authentication of this method is shown in the figure. The purpose of this system is to realize data communication or data synchronization between the first program 101 and the second program 102. The specific implementation method is to embed a public component 103 with data communication and data synchronization functions in the first program 101 and the second program 102 at the same time. In the embodiment of the present application, the public component 103 is embedded in the first program 101 and the second program 102, and the first program 101 and the second program 102 are both host programs of the public component 103. Public components refer to a group of functional units that can be reused by multiple different components or modules during the software development process. It should be noted that in this application, the definition of public components is different. In addition to requiring the functions in the traditional definition and meeting the characteristics of reusability, consistency, and maintainability, the public component 103 shown in the figure includes at least an authentication module 1031, a communication module 1032, a data synchronization module 1033, and component data 1034. The following is a detailed description:

[0038] The authentication module 1031 is used to log in and authenticate the public component. In a specific implementation scenario, preferably, the public component 103 has its own independent user authentication system, and the user login authentication performed on it is independent of the user login authentication of the first program 101 and the second program 102. Alternatively, it can be understood that the login and authentication of the relevant public component 103 does not depend on the login and authentication of the first program 101 and the second program 102. Usually, after the first program 101 and the second program 102 are started and run, the public component 103 is loaded, and the authentication module 1031 is started for authentication. The host program provides user information for authentication, and the authentication module 1031 performs authentication.

[0039] The communication module 1032 is used to establish data communication with other public components on the basis of being authenticated by the authentication module 1031, wherein the other public components are public components that are logged in or authenticated by the same user as the public component 103. Optionally, the communication module 1032 establishes a communication connection with an intermediate server, and the intermediate server is used to provide data synchronization services for the component data. Optionally, the communication module 1032 directly establishes a communication connection with the communication modules of other public components. Preferably, the communication module 1032 establishes data communication with other public components, and does not rely on the communication capabilities of the host program of the public components, that is, the communication module 1032 has the ability to independently establish and execute communication. Furthermore, after the authentication module 1031 performs user authentication, the communication module 1032 automatically establishes a communication connection between the public components that are authenticated by the same user.

[0040] The data synchronization module 1033 is used to perform data synchronization between the multiple public components 103 based on the same user authentication. Optionally, the communication module 1032 establishes data communication between the public components 103 based on the same user authentication. Optionally, the communication module 1032 establishes data communication between the public components 103 based on related user authentication. For example, among enterprise users, managers and employees have a superior-subordinate relationship. On the basis of the separate authentication of the manager user and the employee user, the data synchronization module 1033 performs data synchronization between the public components 103 of the manager user and the public components 103 of the employee user according to the specified business logic, which can achieve the purpose of sharing data and protecting private data in enterprise applications.

[0041] The component data 1034, the component data is the data of the operation of the common component or the data generated and stored. The component data includes program variable data, data stored in memory and data stored in files, etc. Optionally, the data structure of the component data is defined by the common component. It should be noted that in the embodiment of the present application, between multiple common components based on the same or related user login, the component data contained therein is automatically synchronized. Preferably, component data synchronization is performed between the common components, wherein the synchronization rules and the synchronization business logic are not limited by their host programs. Preferably, the first program has a demand for data synchronization with the second program for the data A contained therein, and the specific implementation method is: embed the common component in the first program and the second program respectively, set the data A in the component data of the common component, that is, store the data in the component data, the first program and the second program operate the data A through the attributes and methods of the common component, and rely on the data synchronization capability of the common component itself to achieve data synchronization between the first program and the second program.

[0042] According to the above-mentioned communication system module composition based on common component authentication, the communication method steps based on common component authentication provided in this application are as follows:

[0043] After the first program 101 is started, the common component 103 is loaded, and the first user information is used to log in, and the authentication module 1031 performs authentication on it;

[0044] After the second program 102 is started, the common component 103 is loaded, and the second user information is used to log in, and the authentication module 1032 performs authentication on it, wherein the first user information and the second user information are the same or related user information;

[0045] After the authentication module 1032 authenticates the login, it detects the common component 103 based on the same or related user authentication, that is, it detects that the common component 103 in the first program 101 and the second program 102 is based on the same or related user authentication, and the communication module 1032 of the two common components 103 automatically establishes a communication connection.

[0046] The common component 103 of the first program 101 runs and operates its component data 1034, and performs component data synchronization, including: the data synchronization module 1033 of the common component in the first program 101 synchronizes its component data 1034 to the intermediate server or the common component 1034 of the second program 102; the data synchronization module 1033 of the common component in the second program 102 obtains the component data from the first program 101 or the intermediate server, and updates the component data 1034 in the common component 103 of the second program 102 to keep it synchronized with the component data 1034 in the common component 103 of the first program 101.

[0047] In a possible implementation scenario, Figure 1 In the communication system based on common component authentication shown in FIG. 1 , the first program 101 and the second program 102 may be programs running in different programming languages ​​or in different environments. Figure 3 As shown, the common components include program versions that run based on different operating environments, such as program versions that can be embedded in mobile applications, mini-programs / H5, desktop applications, smart devices, and servers, and also include independent common component program versions, where the versions embedded in mobile applications also include Android, iOS, etc. In addition, desktop applications also include program versions of various programming languages, such as Java, C++, PHP, etc. It should be noted that Figure 3 The common component version classification shown is for example only, and there are other classification methods, such as dividing it based on programming language, including Java, C++, PHP, etc. It should be noted that although the common component includes multiple program versions, each program version has basically the same function, has the same user authentication system, and includes the component data of the same data structure. The purpose of providing multiple versions for the common component is that when the first program 101 and the second program 102 need to be embedded in the common component 103, they can choose a version compatible with it.

[0048] In one possible implementation, Figure 4As shown, the common component in the embodiment of the present application provides methods and properties that can be accessed externally, and the methods can be called by the host program of the common component, and the properties can be read and set by the host program of the common component. The common component encapsulates specific functions and provides methods and properties (also referred to as interfaces or APIs) that can be accessed externally by its host program. These methods and properties enable the host program to interact with the common component. Optionally, the host program of the common component obtains or sets the component data by calling the method provided by the common component. Optionally, the host program of the common component obtains the component data by reading the properties provided by the common component, and the host program of the common component sets the component data by setting the properties provided by the common component. In a possible implementation, the common component also includes its own UI components, UI interactions, etc. By analogy, the common component is such as a Java class, and the methods and properties that can be accessed externally are its public methods and public member variables.

[0049] In one possible implementation, Figure 5 As shown, a public component 103 is embedded in the first program 101 and the second program 102 respectively, and data communication and data synchronization are performed based on the same user authentication of the public component 103. In the component data 1034, the data includes public data 10341 and private data 10342, wherein the public data 10341 maintains data synchronization between public components authenticated by the same user, and the private data 10342 is data for private operations and storage of the public component, and data synchronization is not performed between public components authenticated by the same user. In a specific implementation scenario, the public data 10341 and private data 10342 are defined according to business requirements, and the data synchronization requirements between the first program 101 and the second program 102, as well as the protection requirements for privacy data and private data, are met at the same time. This implementation method is also conducive to specifying the synchronization scope of data.

[0050] In one possible implementation, Figure 6 As shown, the embodiment of the present application also provides a callback function (Callback Function) executed based on the component data synchronization situation, and the main steps are as follows:

[0051] S601, data synchronization starts;

[0052] S602, the common component completes the component data update;

[0053] S603, determine whether the first function exists, if yes, execute S604, otherwise, execute S606;

[0054] S604, determine the first function execution condition, if it meets the condition, execute S605, otherwise, execute S606;

[0055] S605, executing the first function;

[0056] S606, data synchronization ends.

[0057] The above steps can be simply understood as applying the common component to realize data communication or data synchronization between two programs, and executing a specified operation when the data communication or data synchronization meets a certain condition, for example, executing a certain process after the specified data item is updated, and executing a certain process after the specified data item is updated to a specified data range. Preferably, the first function and the execution condition of the first function are defined in the host program of the common component, that is, the common component provides the execution mechanism of the first function, and when the common component is used, the execution content and execution condition of the first function are defined. The above implementation provides an event-driven programming method for applying the common component, and its "events" and execution content about data can be defined by the user independently, and the application is flexible and the program is easy to expand.

[0058] In a possible implementation, data communication and data synchronization are performed based on providing the same user authentication to the common component, in order to effectively control the process of data synchronization, such as Figure 7As shown, a control state identifier is set up for the common component. At the same time, among the multiple common components authenticated by the same user, only one of the common components has a control state identifier set to the master state, and the other common components are in the controlled state. As shown in the figure, at time 1, the common component in program 1 is in the master state, and the common component in program 1 has write permission for its component data. The data synchronization module generates component synchronization data and sends it. The common components in programs 2, 3, and 4 in the controlled state have no write permission for their component data. The data synchronization module receives the synchronization data of the components in program 1 and writes it. At time 2, the common component in program 3 is in the master state, and the common component in program 3 has write permission for its component data. The data synchronization module generates component synchronization data and sends it. The common components in programs 1, 2, and 4 in the controlled state have no write permission for their component data. The data synchronization module receives the synchronization data of component A and writes it. In the above implementation, the synchronization confusion problem caused by the common components in different programs modifying component data at the same time during the data synchronization process is effectively avoided. Optionally, after one of the public components is set to the master state, a notification is sent to other public components based on the same user authentication, and the other public components are set to the controlled state. In another possible implementation, for each data item in the component data, the state of the public component participating in the synchronization is set, that is, at the same time, for each data item in the component data, only one public component is in the master state, and the other public components based on the same user authentication are in the controlled state. On this basis, optionally, with respect to the data items in the component data, for data item A, the first program is in the master state, and the second program is in the controlled state; and for data item B, the second program is in the master state, and the first program is in the controlled state. This method allocates control states to the public components separately for the data items.

[0059] In a possible implementation, data communication or data synchronization is realized between multiple public components based on the same or related user authentication. In a specific application scenario, it cannot be guaranteed that each public component is online. For example, for WeChat software, users cannot guarantee that the PC version and the mobile version are online at the same time to perform synchronization. When the user's PC version is not online, the mobile version uses WeChat and generates data. After the PC version logs in, there is a need to update the usage data. To solve this problem, the public component also includes an online status identifier, which is used to identify the online information of the public component. The public component is run using user information, and the online status identifier is set to an online state. It also includes sending a request to the intermediate server and obtaining the latest component synchronization data of the currently authenticated user. Correspondingly, when the public component in the online state updates its component data, it also includes sending component synchronization data to the intermediate server for other public components to obtain data after going online. Optionally, the data version number is used to identify the update status of the component data.

[0060] In a possible implementation, a public component is included in a program, and data communication or data synchronization capabilities of the public component are utilized to implement data communication or data synchronization between multiple public components authenticated by the same or related users, and the access rights of the public component are restricted so that it does not have the right to access non-public component related resources in its host program. This implementation is conducive to improving the security of using public components, and restricting the public components to run in a sandbox, such as Figure 8 As shown, its host program has access to the methods and component data in the public component, while the public component does not have access to the methods and data in its host program, so that the public component can only access its own resources, call its own methods and access its own data, and run in a restricted environment. In a possible implementation scenario, a restriction mark is set on the method or attribute of the public component, and the restriction mark is used to limit the access rights of the host program and restrict its access to the method with the restriction mark.

[0061] The following uses a browser component as an example of a public component to exemplify and illustrate the communication method based on public component authentication of the present application.

[0062] As we all know, the browser component is a commonly used programming component. There are browser component versions corresponding to almost all programming languages. It is a programming component with browser functions, which is used to display web page content in the program and has an independent operating environment. For example, the Webview component in the Android program and the web-view component in the WeChat applet are all browser components. Each language has a corresponding browser component. Therefore, using the browser component as a common component in this application is undoubtedly a good choice.

[0063] After analysis, the existing browser component does not have the user login authentication function, does not have the automatic communication and data synchronization functions, and the browser data it contains is not used for synchronization. Therefore, it is necessary to add the authentication module, communication module, data synchronization module, and component data required by this application to make it a public component that meets the requirements of the embodiments of this application, specifically:

[0064] A login authentication module is added to the browser component to receive the user name and password provided by the user, perform login verification, and authenticate the user. Optionally, the authenticated user information in the host program is used to perform user authentication of the browser component. Optionally, after the host program is used or logged in for the first time, the user is required to provide the required authentication information of the browser component and perform authentication. Optionally, a service program for user authentication of the browser component is run on an intermediate server. Preferably, the login authentication module in the browser component is an independent user authentication module, which does not rely on the login authentication module in the host program.

[0065] A communication module is added to the browser component, and the communication module is used to establish a communication connection with other browser components. Optionally, after the browser component is started and running, the communication module is also used to establish a communication connection with the intermediate server. Optionally, after the intermediate server authenticates the user, it also includes establishing a communication connection between the browser components with the same user authentication. It includes two forms: establishing a communication connection physically and establishing a communication connection logically, the latter defines the data receiving and forwarding rules in data synchronization. Preferably, the communication connection established between the browser components does not depend on the communication connection between the host programs.

[0066] Browser data is defined in the browser component, and this data is the component data of this application. Existing browser components already contain a variety of data, such as browsing history, cached data, cookies, localStorage and sessionStorage, form data, download history data, local database, etc. Optionally, all of the above data can be defined as part of the component data. Optionally, new data is defined in the existing browser component as the component data. It should be noted that some of the data already contained in the existing browser component is data used to support the operation of web pages, such as localStorage and sessionStorage, etc., which can be defined within the scope of the component data, but it is essentially different from the browser data. For example, we define "data A" as the browser data, and define the browser history record data as a data item of "data A", that is, "A. Browsing history record" represents the record of web pages and files visited in the browsing component. For another example, we define "data1" as a data item of "data A", which is used to synchronize data between programs using the component.

[0067] A data synchronization module is added to the browser component, and the data synchronization module is used to realize automatic browser data synchronization between browser components, wherein multiple browser components participating in the data synchronization need to be based on the same user or related user authentication. The data synchronization module performs data synchronization between browser components, which is independent of the host program in which they are located and is automatically executed. For example, according to the browser data "data A" defined above, the browser history record data is a data item of "data A", that is, "A. Browsing history record" represents the record of web pages and files visited in the browsing component. On the basis of the automatic data synchronization of the browser data, for the same user, the web page record browsed in the PC browser can be easily obtained in the mobile browser, and the developers of the two browsers do not need to write any code for data synchronization. Continuing with the above example, "data1" is a data item of "data A", using the host program 1 and host program 2 of the browser component, when the host program 1 adds a data under "A.data1", the data can be easily obtained in the host program 2, and no code needs to be written for data synchronization.

[0068] After the above improvements, the browser component can become a common component that meets the requirements of the embodiment of the present application. The following is an example of a possible usage scenario. Fig. 9As shown, the Chrome browser 104 and the Webview component 103 are both components of the browser component type. In a possible implementation, the common component in this application may not be embedded in the host program to run, that is, the common component is supported to run independently. In this example, the Chrome browser 104 is equivalent to an independently running browser component or common component. The Webview component 103 is embedded in the Android program 10, and the former is the host program of the latter, thereby automatically realizing data synchronization between the Chrome browser 104 and the Webview component 103. The specific synchronization process is:

[0069] The Chrome browser 104 is started and the user is authenticated, and the authentication module 1041 receives the first user login information and authenticates the user;

[0070] The Android program 10 is started, the Webview component 103 is loaded, and the authentication module 1031 receives the second user login information and authenticates the user. It is determined that the first user information and the second user information are the same or related user information, and the communication module 1032 in the Webview component 103 and the communication module 1042 in the Chrome browser 104 automatically establish a communication connection between the Webview component 103 and the Chrome browser 104;

[0071] In the Chrome browser 104, the user performs an operation, such as browsing a web page, to generate a browsing history record, which is the data under the browser data 1044. The data synchronization module 1043 detects that the browser data 1044 has changed, calculates and generates synchronization data, and sends the synchronization data to the data synchronization module 1033 of the intermediate server or the Webview component 103. The Webview component 103 receives the synchronization data sent by the Chrome browser 104 or the intermediate server, and the data synchronization module 1033 updates and replaces the Webview component data 1034 (equivalent to the browser data) according to the synchronization data, so as to keep it synchronized with the browser data 1044. This step realizes the data synchronization between the Chrome browser 104 and the Android program 10, and the user's browsing history record in the Chrome browser 104 can be obtained in the Android program 10. In the same principle, when browsing a web page by operating the Webview component 103 in the Android program 10, the generated browsing history record can also be obtained in the Chrome browser 104. The beneficial effect that can be obtained is that data synchronization between the Android program 10 and the Chrome browser 104 is achieved without writing any data synchronization code in the Android program 10, and it can be achieved by simply embedding the Webview component 103.

[0072] Optionally, the browser component provides program versions in multiple languages, as above, a Webview component version compatible with the Android program is embedded in the Android program 10, and a UIWebView component version is embedded in the iOS program. It should be noted that each type of the browser component includes an authentication module, a communication module, a data synchronization module and browser data, and the browser data is the component data defined in this application. After the user logs in through authentication, the browser component automatically establishes a communication connection between browser components with the same user authentication, and automatically executes the data synchronization function of the browser data to keep the browser data of the browser components with the same user authentication synchronized.

[0073] Optionally, the browser component provides methods and properties that can be accessed externally. For example, the Webview component 103 provides an API method that can be called by the Android program. The data items in the Webview component data 1034 can be set through the API method. For example, add the "data2" data item and set its value to "value2". Then, in the Chrome browser 104, the "data2" data item and its value can be obtained by calling the corresponding API. In this implementation, the reading and setting requirements of the browser data or Webview component data can be realized through methods and properties. In the above, the method is implemented by functional encapsulation, and the property is implemented by data encapsulation. Both can achieve the same technical effect.

[0074] Optionally, in the browser data, public data and private data attributes are added to the data items contained therein, wherein the public data is synchronized between browser components authenticated by the same user, and the private data is data privately operated and stored between public components, and data synchronization is not performed between browser components authenticated by the same user. The beneficial effect obtained thereby is that the demand for automatic synchronization of data between two programs is met, while the requirements for private operation of the browser components and user privacy protection are met.

[0075] Optionally, the browser component (such as Webview component 103) provides a callback interface function (also called an event listener or event handler) to respond to events related to the data synchronization, for example, calling when the data synchronization starts, calling when the data synchronization is completed, calling when a certain data item is updated, calling when the value update of a certain data item meets a certain condition, etc. On the basis of the browser component providing the callback interface function, the host program (such as Android program 10) defines the execution content of the callback function. Optionally, the triggering rules of the callback function are defined in the host program.

[0076] Optional, such as Fig. 9As shown, component data synchronization is performed between the Webview component 103 and the Chrome browser 104 based on the same or related user authentication. As shown in the figure, the Webview component data 1034 and the browser data 1044 are the component data. In order to avoid the situation where the Webview component 103 and the Chrome browser 104 modify the browser data and perform synchronization at the same time, the Webview component 103 and the Chrome browser 104 also include a control state identifier, which allows only one browser component to be in the master state at the same time, while the other browser component is in the controlled state. The browser component in the master state has write permission for its component data, and the browser component in the controlled state has no write permission for its component data. It is only allowed to update the component data by receiving component synchronization data, and other methods are not allowed to update the component data.

[0077] Optionally, the Webview component 103 and the Chrome browser 104 also include an online status identifier, which is used to identify the user's online information under a certain browser component, use user information to log in to the browser component to run, set the online status identifier to an online state, and also include sending a request to the intermediate server and obtaining the latest component synchronization data of the currently authenticated user.

[0078] Optional, such as Fig. 9 As shown, the Webview component 103 does not have the authority to access related resources in the Android program 10 that do not belong to the Webview component 103.

[0079] In one possible implementation, combining Fig. 9 In the embodiment shown, the Webview component 103 and the Chrome browser 104 perform component data synchronization based on the same or related user authentication. Furthermore, the Webview component data 1034 and the browser data 1044 include web page data for executing web page display in the corresponding browser component, such as web page DOM data, CSS data, HTML data, etc., or the browser component data includes the current display content, including frame data rendered by the browser component, page display screenshots, pictures or drawing instructions generated by drawing the web page content on the Canvas, etc. Synchronizing the above data can achieve the effect of synchronizing the display content between the Webview component 103 and the Chrome browser 104.

[0080] In one possible implementation, combining Fig. 9In the embodiment shown, the Webview component 103 and the Chrome browser 104 perform component data synchronization based on the same or related user authentication. Further, on the basis that the Chrome browser 104 includes an authentication module 1041 and the Webview component 103 includes an authentication module 1031, friends and chat communication functions are added for users of the Chrome browser 104 and the Webview component 103, and the data of this part of the functional modules is established on the basis of the browser data 1044 and the Webview component data 1034. Thus, automatic data synchronization can be achieved in multiple applications and systems that use the browser component. Further, in the browser The component includes a callback function. For example, the callback function is triggered by the receipt of a new chat message. The execution content of the callback function is to display the chat UI interface and display the latest received chat message. The beneficial effect that can be obtained is that a user has multiple smart devices, such as mobile phones, TVs, PADs, computers, etc., and the user uses multiple application software, such as APPs, etc., and the browser component is a very common program component. It is assumed here that its application has been popularized. When the user's friends send chat messages to him, the chat messages can be received in any device and any program of the user. For example, the user is watching a TV program. According to the processing of the callback function by the currently running program on the TV, the user views and processes the chat messages through the TV.

[0081] According to the above implementation, on the basis that the browser component is a very common program component and its application has been popularized, further, the program notification and system message of a certain application are added to the component data. The technical effect that can be obtained is that the browser component provides a new way to transmit messages between multiple programs, which can achieve the same technical effect as the existing message push service.

[0082] In a possible implementation, component data synchronization is performed between the browser components based on the same or related user authentication. Furthermore, the data to be transmitted and shared is placed in the component data, which can achieve the technical effect of transmitting and sharing data between multiple applications. For example, when editing picture A in the first application and using picture A in the second program, when the first program modifies picture A, the modification effect is automatically displayed in the second program without the need for manual update of the second program. For another example, transferring files between two applications can achieve data transmission based on the same user across systems, devices, and programs.

[0083] In summary, the communication method provided by the embodiment of the present application is based on the same or related user authentication of the common component. By embedding the common component in the two programs and providing user authentication for the common component when the program is running, the two host programs can achieve fast communication and data synchronization based on the existing communication and data communication capabilities between the common components. The beneficial effect that can be obtained is that to achieve data synchronization between the two programs, there is no need to write complex data synchronization code. It is only necessary to embed the common component in the two programs and set login authentication for it, thereby reducing costs, improving development efficiency, and expanding the application scenarios of data synchronization technology.

[0084] The above are only specific implementations of the embodiments of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any changes or replacements that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed in the embodiments of the present application should be included in the protection scope of the embodiments of the present application. Therefore, the protection scope of the embodiments of the present application shall be based on the protection scope of the claims.

Claims

1. A communication method based on public component authentication, the method being used to implement data sharing and / or data communication between a first program and a second program, characterized in that: include: A common component is embedded in the first program and the second program respectively. The first program and the second program are host programs of the common component. The common component is a logically complete and independent running unit, which can be embedded in the host program to run and interact with the host program or other components. It at least includes a login module, a communication module, a data synchronization module, and component data. The login module is used for login authentication. The communication module is used to establish a communication connection between common components based on the same user authentication or to establish a communication connection with an intermediate server. The intermediate server is used to provide a data synchronization service for the component data. The data synchronization module is used to realize data synchronization of component data between the common components based on the same user authentication. The component data is the data of the operation operation of the common component or the data generated and stored; After the first program is started, the public component embedded therein is loaded, and the public component of the first program is logged in using the first user information to run; after the second program is started, the public component embedded therein is loaded, and the public component embedded therein is logged in using the second user information to run; wherein the first user information and the second user information are the same or related user information; The common component of the first program runs and operates its component data, and performs component data synchronization, including: the data synchronization module of the common component in the first program synchronizes its component data to the second program or the intermediate server; the data synchronization module of the common component in the second program obtains the component data from the first program or the intermediate server, and updates the component data in the common component of the second program to keep it synchronized with the component data in the common component of the first program.

2. The method according to claim 1, characterized in that The common component includes program versions running based on different operating environments, but have the same user authentication and functions, and the component data of the common components of different program versions include the same data structure, and the program versions of the common components embedded in the first program and the second program are compatible with their host programs.

3. The method according to claim 1, characterized in that The public component provides methods and properties that can be accessed externally. The methods can be called by its host program, and the properties can be read and set by its host program.

4. The method according to claim 3, characterized in that In the first program and the second program, the first program and the second program call the method to obtain or set the component data, or the attribute includes a data member in the component data, and the first program and the second program obtain the component data by reading the attribute, and the first program and the second program set the component data by setting the attribute.

5. The method according to claim 4, characterized in that The data in the component data includes public data and private data, wherein the public data maintains data synchronization between public components authenticated by the same user as the public component to which it belongs, and the private data is data privately operated and stored between public components, and data synchronization is not performed between public components authenticated by the same user as the public component to which it belongs.

6. The method according to claim 1, characterized in that In the first program or the second program, when the common component completes the component data update, the execution of the first function is triggered, wherein the first function is registered and called in the common component, and the execution content of the first function is defined by the host program of the common component.

7. The method according to claim 1, characterized in that The public component also includes a control status identifier. At the same moment, among the multiple public components based on the same user authentication, only one public component's control status identifier is set to a master control state, and the other public components are in a controlled state. The public component in the master control state has write permission for its component data, and the data synchronization module generates and sends component synchronization data. The public component in the controlled state has no write permission for its component data, and the data synchronization module receives and writes the component synchronization data.

8. The method according to claim 1, characterized in that The public component also includes an online status identifier, which is used to identify the online information of the public component. The public component is logged in using user information to run, and the online status identifier is set to an online state. It also includes sending a request to the intermediate server and obtaining the latest component synchronization data of the currently authenticated user.

9. The method according to claim 1, characterized in that: The public component does not have the authority to access the non-public component related resources in its host program.

10. The method according to claim 1, characterized in that Also includes: The common component is a browser component; The browser component is included in both the first program and the second program, wherein the browser component is a browser program based on the same or related user authentication, and the browser components in the first program and the second program at least include a browser module, a communication module, an authentication module, a data synchronization module, and browser data, wherein the browser module is used to perform web browsing, the communication module is used to establish a communication connection between the browser components in the first program and the second program, the authentication module is used for login authentication, the data synchronization module is used to synchronize the browser data, and the browser data is the data of the browser component running operation or the data generated and stored; When the first program is started and executed, the browser component is loaded, and the browser component included in the first program is logged in based on the first user information to run; when the second program is started and executed, the browser component is loaded, and the browser component included in the second program is logged in based on the second user information to run; wherein the first user information and the second user information are the same or related user information; In the first program, the browser component is run and the browser data is operated to perform browser data synchronization, including: the data synchronization module of the first program synchronizes the browser data from the browser component of the first program to the browser component of the second program or the intermediate server; the data synchronization module of the browser component in the second program obtains the browser data from the first program or the intermediate server, and updates the browser data in the browser component of the second program to keep it synchronized with the browser data in the browser component of the first program.

Citation Information

Cited By

  • Communication optimization method and system for connecting back-end equipment with front-end equipment

    CN120934731A