Communication method, device, equipment and storage medium between application program and program page
By establishing a long link between the APP and the H5 page, the problem that the APP cannot directly control the H5 page is solved, and direct communication between the APP and the H5 page is realized, which improves the collaboration effect and the versatility of the mini program.
Patent Information
- Application Number
- CN202111535029.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2041-12-15
AI Technical Summary
In the existing technology, direct communication cannot be performed between the APP and the H5 page, resulting in the inability to meet the APP's control requirements for the H5 page.
Establish the first long link between the application and the target program, send a page open instruction to open the embedded page in the target program, and integrate the communication program in the page to establish the second long link between the APP and the H5 page to achieve direct communication.
It enables APP to directly control H5 pages, improves the collaboration between APP, mini-programs and H5 pages, and enhances the versatility and user experience of mini-programs.
Smart Images

Figure CN114237933B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, apparatus, computer equipment, and storage medium for communication between an application program and a program page. Background Art
[0002] In many app application scenarios (such as online meetings and live streaming), the app often needs to collaborate with embedded mini-programs within the app, with the app remotely controlling the mini-program to perform certain business functions, such as sharing sketchpads and files. Specifically, the webview container within the app typically enables real-time communication between the app and the mini-program, allowing the app to transfer data to the mini-program in real time to implement these functions. Nowadays, with the emergence of HTML5, more and more content needs to be carried by H5 pages, such as HTML5 graphic pages and HTML5-produced PowerPoint presentations. As apps and mini-programs collaborate, apps are also increasingly demanding control over H5 pages. However, current webview containers do not enable direct real-time communication between the app and the H5 page, and can only perform basic information transfer when opening and closing the H5 page. The H5 page tends to be a closed environment within the mini-program, which cannot effectively meet the app's control needs over the H5 page. Therefore, the existing technology still lacks a communication method that enables direct communication between the app and the H5 page. Summary of the Invention
[0003] The technical problem to be solved by the present invention is that in the prior art, direct communication between the APP and the H5 page is not possible.
[0004] In order to solve the above technical problems, the first aspect of the present invention discloses a communication method between an application and a program page, the method comprising:
[0005] Establishing a first long link between an application and a target program associated with the application, wherein the first long link is used for message transmission between the application and the target program;
[0006] Controlling the application to send a page opening instruction to the target program based on the first long link;
[0007] Controlling the target program to open a program page embedded in the target program after receiving the page opening instruction;
[0008] A second long link is established between the program page and the application program based on a communication program pre-integrated in the program page, wherein the second long link is used for message transmission between the application program and the program page.
[0009] A second aspect of the present invention discloses a communication device between an application and a program page, the device comprising:
[0010] a long link establishing module, configured to establish a first long link between an application and a target program associated with the application, wherein the first long link is used for message transmission between the application and the target program;
[0011] An instruction sending module, configured to control the application to send a page opening instruction to the target program based on the first long link;
[0012] A page opening module, configured to control the target program to open a program page embedded in the target program after receiving the page opening instruction;
[0013] The long link establishment module is further used to establish a second long link between the program page and the application based on a communication program pre-integrated in the program page, wherein the second long link is used for message transmission between the application and the program page.
[0014] A third aspect of the present invention discloses a computer device, comprising:
[0015] a memory storing executable program code;
[0016] a processor connected to the memory;
[0017] The processor calls the executable program code stored in the memory to execute part or all of the steps of the communication method between the application program and the program page disclosed in the first aspect of the present invention.
[0018] The fourth aspect of the present invention discloses a computer storage medium, which stores computer instructions. When the computer instructions are called, they are used to execute some or all steps of the communication method between an application and a program page disclosed in the first aspect of the present invention.
[0019] In an embodiment of the present invention, a first long link is first established between the APP (i.e., the application program) and the mini-program embedded in the APP (i.e., the target program associated with the application program), and then the APP sends an H5 open instruction (i.e., a page open instruction) to the mini-program based on the first long link. Then, after receiving the H5 open instruction, the mini-program opens the H5 page embedded in the mini-program (i.e., the program page), and finally, based on the communication program pre-integrated in the H5 page, a second long link is established between the H5 page and the APP. By integrating the communication program in the H5 page and then establishing a long link between the APP and the H5 page, direct communication between the APP and the H5 page can be achieved, so that the APP can directly control the H5 page in the mini-program, and no longer needs to control the H5 page through the mini-program, thereby decoupling the function and content of the mini-program, enhancing the versatility of the mini-program, making the H5 page bear the content, and the mini-program focusing on functional logic, thereby improving the collaboration effect between the APP, the mini-program, and the H5 page. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 This is a flow chart of a method for communicating between an application and a program page disclosed in an embodiment of the present invention;
[0022] Figure 2 This is an overall framework diagram of a communication method between an application and a program page disclosed in an embodiment of the present invention;
[0023] Figure 3 It is a structural diagram of a communication device between an application and a program page disclosed in an embodiment of the present invention;
[0024] Figure 4 It is a structural diagram of a computer device disclosed in an embodiment of the present invention;
[0025] Figure 5 It is a structural diagram of a computer storage medium disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0027] The terms "first," "second," and so on, in the description and claims of the present invention and the accompanying drawings are used to distinguish between different items, not to describe a specific order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or end comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed therein, or may optionally include other steps or elements inherent to such process, method, product, or end.
[0028] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0029] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0030] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0031] The present invention discloses a communication method, device, computer equipment and storage medium between an application and a program page. First, a first long link is established between an APP and a mini-program embedded in the APP. Then, the APP sends an H5 open instruction to the mini-program based on the first long link. Then, after receiving the H5 open instruction, the mini-program opens the H5 page embedded in the mini-program. Finally, a second long link is established between the H5 page and the APP based on a communication program pre-integrated in the H5 page. By integrating the communication program in the H5 page and then establishing a long link between the APP and the H5 page, direct communication can be achieved between the APP and the H5 page, so that the APP can directly control the H5 page in the mini-program, and no longer needs to control the H5 page through the mini-program, thereby decoupling the function and content of the mini-program, enhancing the versatility of the mini-program, making the H5 page bear the content, and the mini-program focusing on functional logic, thereby improving the collaboration effect between the APP, the mini-program and the H5 page. The following are detailed descriptions.
[0032] Example 1
[0033] See also Figure 1 , Figure 1 This is a flow chart of a communication method between an application and a program page disclosed in an embodiment of the present invention. Figure 1 As shown, the communication method between the application and the program page may include the following operations:
[0034] 101. Establish a first long link between an application and a target program associated with the application, wherein the first long link is used for message transmission between the application and the target program.
[0035] In the above step 101, although the current webview container fails to realize real-time communication between the APP (i.e., the application) and the H5 page (i.e., the program page), or between the mini program (i.e., the target program) and the H5 page, it can realize real-time communication between the APP and the mini program. Therefore, the first long link between the APP and the mini program can be established based on the existing functions of the webview container, thereby realizing communication between the APP and the mini program first. It should be noted that the long link is a general real-time communication solution, and the two ends of the long link can communicate in this way.
[0036] 102. Control the application to send a page opening instruction to the target program based on the first long link.
[0037] In the above step 102, after the communication between the APP and the mini program is established, the APP can send an H5 opening instruction (i.e., a page opening instruction) to the mini program, so that the mini program opens the H5 page.
[0038] 103. Control the target program to open a program page embedded in the target program after receiving the page opening instruction.
[0039] In the above step 103, after receiving the page opening instruction, the mini program can open the H5 page embedded in the mini program (ie, the program page).
[0040] 104. Establish a second long link between the program page and the application program based on a communication program pre-integrated in the program page, wherein the second long link is used for message transmission between the application program and the program page.
[0041] In step 104 above, a communication program (the communication program will be described in detail later) is pre-integrated into the H5 page. After the H5 page is opened, a long link is established between the H5 page and the APP through the communication program, thus enabling communication between the APP and the H5 page. Specifically, enabling communication between the APP and the H5 page is of great significance in some application scenarios, such as the synchronization of VR scenes. Currently, most VR scenes are produced by H5 pages. The VR scene of the H5 page can be opened in the mini program, and the APP controls the interaction within the scene. The user is designated to watch the scene and explanations are provided at the same time, which can greatly enhance the user's immersive experience and the value of VR resources.
[0042] To better understand the communication method between the application and the program page in the embodiment of the present invention, please refer to Figure 2 , Figure 2 It is an overall framework diagram showing a communication method between an application and a program page disclosed in an embodiment of the present invention.
[0043] It can be seen that implementation Figure 1 The described method of communication between an application and a program page first establishes a first long link between the APP and the mini-program embedded in the APP. Then, based on the first long link, the APP sends an H5 opening instruction to the mini-program. Then, after receiving the H5 opening instruction, the mini-program opens the H5 page embedded in the mini-program. Finally, based on the communication program pre-integrated in the H5 page, a second long link is established between the H5 page and the APP. By integrating the communication program in the H5 page and then establishing a long link between the APP and the H5 page, direct communication between the APP and the H5 page can be achieved, so that the APP can directly control the H5 page in the mini-program without having to control the H5 page through the mini-program. This decouples the function and content of the mini-program, enhances the versatility of the mini-program, and enables the H5 page to bear the content, while the mini-program focuses on functional logic, thereby improving the collaboration effect between the APP, mini-program and H5 page.
[0044] In an optional embodiment, after establishing the second long link between the program page and the application program based on the communication program pre-integrated in the program page, the method further includes:
[0045] Controlling the target program to send page content data to the program page based on the second long link;
[0046] Determining whether the page content data is successfully sent;
[0047] When it is determined that the page content data is not successfully sent, a preset error handling operation is performed to enable the program page to complete loading of the page content data.
[0048] In this optional embodiment, during the communication process between the mini program and the H5 page, a flag data can be set in the H5 content data (i.e., the page content data) sent by the mini program to the H5 page. The flag data can be set according to the sending status of the H5 content data. For example, if the H5 content data is sent successfully, the flag data is set to 1, and if the H5 content data is sent unsuccessfully, the flag data is set to 0. By detecting the value of the flag data in the H5 content data, it is possible to determine whether the H5 content data is sent successfully and perform corresponding processing subsequently.
[0049] It can be seen that by implementing this optional embodiment, after establishing the second long link between the H5 page and the APP, after the mini program sends the H5 content data to the H5 page, if the H5 content data is not sent successfully, an error handling operation is performed to enable the H5 page to complete the loading of the H5 content data, which is conducive to ensuring the stability of the communication method between the application and the program page.
[0050] In an optional embodiment, executing a preset error handling operation includes:
[0051] Determining whether the second long link meets a preset data sending condition;
[0052] When it is determined that the second long link meets the data sending condition, re-establishing the second long link and triggering the step of controlling the target program to send page content data to the program page based on the second long link;
[0053] When it is determined that the second long link does not meet the data sending condition, the target program reloads the program page based on the page content data.
[0054] In this optional embodiment, when the H5 content data fails to be successfully sent, it may be that there is a problem with the communication in the second long link, or there may be an unknown problem in the H5 page. In order to successfully complete the loading of the H5 content data, different processing methods can be adopted for different situations that cause the H5 content data to fail to be successfully sent so that the H5 content data can be loaded. If there is no abnormality in the communication in the second long link, it can usually be solved by re-establishing the second long link and then sending the H5 content data again. If there is an abnormality in the communication in the second long link (that is, this situation may not be solved by re-establishing the second long link), the applet can be made to directly use the H5 content data to reopen the H5 page. At this time, the H5 content data can be avoided from being transmitted in the long link, so that it will not be affected by the communication conditions of the second long link. Among them, judging whether the second long link is abnormal can be achieved by judging whether the second long link meets the data sending conditions, which will be described in detail later.
[0055] It can be seen that when implementing this optional embodiment, when performing error handling, it is first determined whether the second long link meets the data sending conditions. If the conditions are met, the second long link is re-established and the H5 content data is re-sent through the second long link. If the conditions are not met, the mini program reloads the H5 page based on the H5 content data, which is conducive to ensuring that the H5 page can successfully complete the loading of the H5 content data and improve the stability of the communication between the application and the program page.
[0056] In an optional embodiment, determining whether the second long link meets a preset data sending condition includes:
[0057] Determining the data bandwidth of the second long link and the data volume of the page content data;
[0058] Determining whether the data volume of the page content data is greater than the data bandwidth;
[0059] When it is determined that the data volume of the page content data is greater than the data bandwidth, determining that the second long link does not meet the data sending condition;
[0060] When it is determined that the data volume of the page content data is not greater than the data bandwidth, it is determined that the second long link meets the data transmission condition, or,
[0061] determining a communication delay value of the second longest link;
[0062] Determining whether the communication delay value is greater than a preset communication delay threshold;
[0063] When it is determined that the communication delay value is greater than the communication delay threshold, determining that the second long link does not meet the data sending condition;
[0064] When it is determined that the communication delay value is not greater than the communication delay threshold, it is determined that the second long link meets the data sending condition.
[0065] In this optional embodiment, there are generally two reasons why the second long link communication is abnormal: (1) The data volume of the H5 content data is too large, exceeding the data bandwidth of the second long link, resulting in the H5 content data being unable to be successfully sent. (2) The communication delay of the second long link is high, resulting in the H5 content data being unable to be successfully sent. Therefore, it is possible to determine whether the second long link meets the data sending conditions by judging the data bandwidth and communication delay of the second long link.
[0066] It can be seen that when implementing this optional embodiment, when judging whether the second long link meets the data sending conditions, it is achieved by judging whether the data volume of the H5 content data is greater than the data bandwidth of the second long link or by judging whether the communication delay value of the second long link is greater than the communication delay threshold, thereby being able to accurately judge whether the second long link meets the data sending conditions.
[0067] In an optional embodiment, the communication program is a script obtained by copying and encapsulating the target code in the preset shared whiteboard software, wherein the target code refers to the code in the shared whiteboard software for realizing real-time communication between the application program and the target program.
[0068] In this optional embodiment, the shared whiteboard software typically consists of two parts: the whiteboard body and the communication module. The code for the communication module in the shared whiteboard software can be copied and packaged, and some simple and convenient interfaces (such as establishing a connection, sending messages, and receiving messages) can be provided to the outside world, thereby being used as an independent SDK. Specifically, the communication module separated from the shared whiteboard software is a js file (i.e., a script). H5 directly imports this js file, which can integrate the communication program into the H5 page.
[0069] It can be seen that by implementing this optional embodiment, by separating the communication program from the shared whiteboard software and then integrating the communication program into the H5 page, the communication between the APP and the H5 page can be achieved in a simpler implementation manner.
[0070] In an optional embodiment, before establishing the first long link between the application and the target program associated with the application, the method further includes:
[0071] Controlling the application program to send an identity identifier to the target program;
[0072] Controlling the target program to verify the identity;
[0073] When the target program passes the verification of the identity identifier, triggering the step of establishing a first long link between the application and the target program associated with the application;
[0074] Furthermore, before establishing the second long link between the program page and the application program based on the communication program pre-integrated in the program page, the method further includes:
[0075] Controlling the target program to send the received identity identifier to the program page;
[0076] Controlling the program page to verify the identity;
[0077] When the program page passes the verification of the identity identifier, the step of establishing a second long link between the program page and the application program based on the communication program pre-integrated in the program page is triggered.
[0078] In this optional embodiment, to ensure communication security, before establishing the first long link, the app and mini-program that will establish the first long link can first be authenticated using identity identification. After the identity verification is passed, the first long link is established. Similarly, before establishing the second long link, the app and H5 page that will establish the second long link can also be authenticated.
[0079] It can be seen that by implementing this optional embodiment, before establishing the first long link and the second long link, the identities of the APP, mini program and H5 page are first verified, which is conducive to ensuring the security of communication between the APP and the H5 page.
[0080] In an optional embodiment, the message transmitted in the first long link includes an application-side message and a first target program-side message, wherein the beginning portion of each of the application-side messages is provided with an application identification character, and the beginning portion of each of the first target program-side messages is provided with a first target program identification character;
[0081] In addition, the messages transmitted in the second long link include second target program-side messages and page-side messages, wherein the starting part of each second target program-side message is set with a second target program identification character, and the starting part of each page-side message is set with a page identification character.
[0082] In this optional embodiment, in actual applications, to prevent messages transmitted over long links from interfering with each other, a set of customized message rules can be used. Specifically, an identifier character can be set at the beginning of a transmitted message to distinguish between the two endpoints. For example, "$mini$" can be set at the beginning of a message sent to an application as the application identifier. The application then only receives messages beginning with "$mini$." This isolates messages transmitted by each endpoint and prevents interference.
[0083] It can be seen that by implementing this optional embodiment, the identification characters of each end are set at the beginning of the message transmitted in the long link, so that the messages transmitted by each end in the long link can be isolated, avoiding mutual interference between the messages transmitted in the long link, and improving the stability of communication between the application and the program page.
[0084] Optionally, the communication method between the application and the program page in the embodiment of the present invention can be applied in a smart medical system, wherein the APP can be a terminal on the user side of the smart medical system, and the H5 page can be used to display hospital information, patient information, medical records, doctor information and other information to the user.
[0085] Optionally, the communication information of the communication method between the application and the program page can be uploaded to the blockchain.
[0086] Specifically, the communication information is obtained by running the communication method between the application and the program page and is used to record the communication status between the application and the program page, such as the establishment time of the first long link, the time the page open command was sent, the establishment time of the second long link, and so on. Uploading this communication information to the blockchain ensures its security and fairness and transparency for users. Users can download this communication information from the blockchain to verify whether the communication information of the communication method between the application and the program page has been tampered with. The blockchain referred to in this example is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Blockchain is essentially a decentralized database, a string of data blocks generated using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of the information (to prevent counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.
[0087] Example 2
[0088] See also Figure 3 , Figure 3 This is a schematic diagram of the structure of a communication device between an application and a program page disclosed in an embodiment of the present invention. Figure 3As shown, the communication means between the application and the program page may include:
[0089] A long link establishing module 201 is configured to establish a first long link between an application and a target program associated with the application, wherein the first long link is used for message transmission between the application and the target program;
[0090] An instruction sending module 202 is configured to control the application to send a page opening instruction to the target program based on the first long link;
[0091] The page opening module 203 is used to control the target program to open the program page embedded in the target program after receiving the page opening instruction;
[0092] The long link establishing module 201 is further configured to establish a second long link between the program page and the application based on a communication program pre-integrated in the program page, wherein the second long link is used for message transmission between the application and the program page.
[0093] In an optional embodiment, the device further comprises:
[0094] a sending module, configured to control the target program to send page content data to the program page based on the second long link after the long link establishing module 201 establishes a second long link between the program page and the application program based on the communication program pre-integrated in the program page;
[0095] A judgment module, judging whether the page content data is successfully sent;
[0096] The error handling module is used to execute a preset error handling operation when it is determined that the page content data is not successfully sent, so that the program page completes loading of the page content data.
[0097] In an optional embodiment, the specific manner in which the error handling module performs the preset error handling operation is:
[0098] Determining whether the second long link meets a preset data sending condition;
[0099] When it is determined that the second long link meets the data sending condition, re-establishing the second long link and triggering the step of controlling the target program to send page content data to the program page based on the second long link;
[0100] When it is determined that the second long link does not meet the data sending condition, the target program reloads the program page based on the page content data.
[0101] In an optional embodiment, the error handling module determines whether the second long link meets the preset data sending condition in the following specific manner:
[0102] Determining the data bandwidth of the second long link and the data volume of the page content data;
[0103] Determining whether the data volume of the page content data is greater than the data bandwidth;
[0104] When it is determined that the data volume of the page content data is greater than the data bandwidth, determining that the second long link does not meet the data sending condition;
[0105] When it is determined that the data volume of the page content data is not greater than the data bandwidth, it is determined that the second long link meets the data transmission condition, or,
[0106] determining a communication delay value of the second longest link;
[0107] Determining whether the communication delay value is greater than a preset communication delay threshold;
[0108] When it is determined that the communication delay value is greater than the communication delay threshold, determining that the second long link does not meet the data sending condition;
[0109] When it is determined that the communication delay value is not greater than the communication delay threshold, it is determined that the second long link meets the data sending condition.
[0110] In an optional embodiment, the communication program is a script obtained by copying and encapsulating the target code in the preset shared whiteboard software, wherein the target code refers to the code in the shared whiteboard software for realizing real-time communication between the application program and the target program.
[0111] In an optional embodiment, the sending module is further configured to control the application to send the identity identifier to the target program before the long link establishing module 201 establishes the first long link between the application and the target program associated with the application;
[0112] And, the device further comprises:
[0113] a verification module configured to control the target program to verify the identity identifier; and, when the target program successfully verifies the identity identifier, trigger the long link establishment module 201 to execute the step of establishing the first long link between the application and the target program associated with the application;
[0114] Furthermore, the sending module is further configured to control the target program to send the received identity identifier to the program page before the long link establishing module 201 establishes a second long link between the program page and the application program based on the communication program pre-integrated in the program page;
[0115] The verification module is also used to control the program page to verify the identity identifier; when the program page passes the verification of the identity identifier, it triggers the long link establishment module 201 to execute the step of establishing a second long link between the program page and the application based on the communication program pre-integrated in the program page.
[0116] In an optional embodiment, the message transmitted in the first long link includes an application-side message and a first target program-side message, wherein the beginning portion of each of the application-side messages is provided with an application identification character, and the beginning portion of each of the first target program-side messages is provided with a first target program identification character;
[0117] In addition, the messages transmitted in the second long link include second target program-side messages and page-side messages, wherein the starting part of each second target program-side message is set with a second target program identification character, and the starting part of each page-side message is set with a page identification character.
[0118] For the detailed description of the communication device between the application and the program page, reference may be made to the detailed description of the communication method between the application and the program page. To avoid repetition, detailed description will not be given here.
[0119] Example 3
[0120] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of a computer device disclosed in an embodiment of the present invention. Figure 4 As shown, the computer device may include:
[0121] A memory 301 storing executable program code;
[0122] a processor 302 connected to the memory 301;
[0123] The processor 302 calls the executable program code stored in the memory 301 to execute the steps of the communication method between the application program and the program page disclosed in the first embodiment of the present invention.
[0124] Example 4
[0125] See also Figure 5The embodiment of the present invention discloses a computer storage medium 401, which stores computer instructions. When the computer instructions are called, they are used to execute the steps in the communication method between the application and the program page disclosed in the first embodiment of the present invention.
[0126] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, i.e., they may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Those skilled in the art can understand and implement the present invention without inventive effort.
[0127] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus the necessary general hardware platform, or of course, by means of hardware. Based on this understanding, the above technical solution, in essence, or the portion that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, including a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0128] Finally, it should be noted that the communication method, device, computer equipment, and storage medium between an application and a program page disclosed in the embodiments of the present invention are only preferred embodiments of the present invention and are only used to illustrate the technical solutions of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the aforementioned embodiments, it should be understood by those skilled in the art that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A communication method between an application and a program page, characterized in that: The method comprises: Establishing a first long link between an application and a target program associated with the application, wherein the first long link is used for message transmission between the application and the target program; Controlling the application to send a page opening instruction to the target program based on the first long link; Controlling the target program to open a program page embedded in the target program after receiving the page opening instruction; establishing a second long link between the program page and the application based on a communication program pre-integrated in the program page, wherein the second long link is used for message transmission between the application and the program page; and uploading communication information between the application and the program page to the blockchain; Controlling the target program to send page content data to the program page based on the second long link; Determining whether the page content data is successfully sent; the determining whether the page content data is successfully sent includes setting flag data in the page content data, wherein the value of the flag data is set according to the sending status of the page content data, and determining whether the page content data is successfully sent by detecting the value of the flag data; When it is determined that the page content data is not successfully sent, a preset error handling operation is performed to enable the program page to complete loading of the page content data.
2. The method for communication between an application and a program page according to claim 1, wherein: The executing of the preset error handling operation includes: Determining whether the second long link meets a preset data sending condition; When it is determined that the second long link meets the data sending condition, re-establishing the second long link and triggering the step of controlling the target program to send page content data to the program page based on the second long link; When it is determined that the second long link does not meet the data sending condition, the target program reloads the program page based on the page content data.
3. The method for communication between an application and a program page according to claim 2, wherein: The determining whether the second long link satisfies a preset data sending condition includes: Determining the data bandwidth of the second long link and the data volume of the page content data; Determining whether the data volume of the page content data is greater than the data bandwidth; When it is determined that the data volume of the page content data is greater than the data bandwidth, determining that the second long link does not meet the data sending condition; When it is determined that the data volume of the page content data is not greater than the data bandwidth, it is determined that the second long link meets the data transmission condition, or, determining a communication delay value of the second longest link; Determining whether the communication delay value is greater than a preset communication delay threshold; When it is determined that the communication delay value is greater than the communication delay threshold, determining that the second long link does not meet the data sending condition; When it is determined that the communication delay value is not greater than the communication delay threshold, it is determined that the second long link meets the data sending condition.
4. The method for communication between an application and a program page according to any one of claims 1 to 3, characterized in that: The communication program is a script obtained by copying and encapsulating the target code in the preset shared whiteboard software, wherein the target code refers to the code in the shared whiteboard software for realizing real-time communication between the application program and the target program.
5. The method for communication between an application and a program page according to any one of claims 1 to 3, characterized in that: Before establishing the first long link between the application and the target program associated with the application, the method further includes: Controlling the application program to send an identity identifier to the target program; Controlling the target program to verify the identity; When the target program passes the verification of the identity identifier, triggering the step of establishing a first long link between the application and the target program associated with the application; Furthermore, before establishing the second long link between the program page and the application program based on the communication program pre-integrated in the program page, the method further includes: Controlling the target program to send the received identity identifier to the program page; Controlling the program page to verify the identity; When the program page passes the verification of the identity identifier, the step of establishing a second long link between the program page and the application program based on the communication program pre-integrated in the program page is triggered.
6. The method for communication between an application and a program page according to any one of claims 1 to 3, characterized in that: The messages transmitted in the first long link include application-side messages and first target-side messages, wherein the beginning portion of each application-side message is provided with an application identification character, and the beginning portion of each first target-side message is provided with a first target program identification character; In addition, the messages transmitted in the second long link include second target program-side messages and page-side messages, wherein the starting part of each second target program-side message is set with a second target program identification character, and the starting part of each page-side message is set with a page identification character.
7. A communication device between an application and a program page, characterized in that: The device comprises: a long link establishing module, configured to establish a first long link between an application and a target program associated with the application, wherein the first long link is used for message transmission between the application and the target program; An instruction sending module, configured to control the application to send a page opening instruction to the target program based on the first long link; A page opening module, configured to control the target program to open a program page embedded in the target program after receiving the page opening instruction; The long link establishment module is further configured to establish a second long link between the program page and the application based on a communication program pre-integrated in the program page, wherein the second long link is used for message transmission between the application and the program page; and upload communication information between the application and the program page to the blockchain; A sending module, configured to control the target program to send page content data to the program page based on the second long link; a determination module, configured to determine whether the page content data has been successfully sent; the determination of whether the page content data has been successfully sent includes setting flag data in the page content data, wherein the value of the flag data is set according to the sending status of the page content data, and determining whether the page content data has been successfully sent by detecting the value of the flag data; The error handling module is used to execute a preset error handling operation when it is determined that the page content data is not successfully sent, so that the program page completes loading of the page content data.
8. A computer device, characterized in that: The computer device comprises: a memory storing executable program code; a processor connected to the memory; The processor calls the executable program code stored in the memory to execute the communication method between the application program and the program page according to any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for communication between an application program and a program page according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Communication method and device of communication application and electronic equipment
CN111885194A