Page data transmission method and device, storage medium and electronic device
By obtaining and transmitting the container data of the application after the front-end page is initialized, and obtaining the page data from the application for format conversion, compression and encryption after receiving the calling instruction, the problem of low page data transmission efficiency is solved and high efficiency is achieved. Page data transfer and application compatibility.
Patent Information
- Application Number
- CN202410673929.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-09-17
AI Technical Summary
In the existing technology, there is a problem of low efficiency when transmitting page data to the front-end page, and there is no effective solution.
By obtaining the container data of the application after the front-end page is initialized and sending it to the front-end page, after receiving the calling instructions, the page data is obtained from the application, and the format is converted, compressed and encrypted, and the page data in a unified format is transmitted to Front-end page.
It improves the transmission efficiency of page data, enhances the compatibility of different applications and the integrity of the transmission process.
Smart Images

Figure CN118656559A
Abstract
Description
Technical Field
[0001] The present application relates to the field of smart home technology, and more specifically, to a method, device, storage medium and electronic device for transmitting page data. Background Art
[0002] At present, with the continuous development of Internet technology, front-end pages are establishing data associations with more and more mobile applications. In particular, when the same front-end page is displayed on applications in different scenarios, the upload process of the required data is also different. The front-end page must perform corresponding logical processing for different scenarios, which requires the regeneration of the corresponding application code, which will affect the data upload speed.
[0003] Therefore, in the related art, when transmitting page data to the front-end page, there is a technical problem of how to improve the transmission efficiency.
[0004] In the related art, there is no effective solution to the technical problem of how to improve the transmission efficiency when transmitting page data to the front-end page. Summary of the invention
[0005] The embodiments of the present application provide a method, device, storage medium and electronic device for transmitting page data, so as to at least solve the technical problem in the related art of how to improve the transmission efficiency when transmitting page data to a front-end page.
[0006] According to one aspect of an embodiment of the present application, a method for transmitting page data is provided, comprising: after initialization is completed based on an initialization instruction of a front-end page, obtaining container data of an application, wherein the container data represents data of the application after containerization configuration; sending the container data to the front-end page; upon receiving a call instruction generated by the front-end page based on the container data, executing the call instruction to obtain page data required for page display by the front-end page from the application, and transmitting the page data in a unified format to the front-end page.
[0007] In an exemplary embodiment, before transmitting the page data having a unified format to the front-end page, the method further includes: encapsulating the page data according to a pre-agreed encapsulation method, including: performing format conversion on the page data to obtain first converted data, the first converted data being a Blob object; obtaining first compressed data obtained by performing a compression operation on the first converted data; encrypting the first compressed data to obtain first encrypted data, and determining the first encrypted data as the page data having a unified format.
[0008] In an exemplary embodiment, before transmitting the page data having a unified format to the front-end page, the method further includes: encapsulating the page data according to a pre-agreed encapsulation method, including: performing format conversion on the page data to obtain second converted data, the second converted data being an ArrayBuffer object; obtaining second compressed data obtained by performing a compression operation on the second converted data; encrypting the second compressed data to obtain second encrypted data; converting the second encrypted data from the ArrayBuffer object to a Blob object, and determining the converted second encrypted data as the page data having a unified format.
[0009] In an exemplary embodiment, initialization is performed in the following manner: determining an initialization configuration file from the initialization instruction; determining a front-end framework corresponding to the front-end page, and determining a configuration path of the front-end framework; storing the initialization configuration file to the configuration path to complete initialization.
[0010] In an exemplary embodiment, the method includes: determining a current program version number of the application from the container data; sending the container data to the front-end page when it is determined that the current program version number is higher than a default program version number; redirecting the container data to a compatible processing path when it is determined that the current program version number is lower than a default program version number; updating the container data under the compatible processing path to update the current program version number of the application to a default program version number, and sending the updated container data to the front-end page.
[0011] In an exemplary embodiment, sending the container data to the front-end page includes: determining the running status of the application from the container data, and when it is determined that the running status is healthy, performing an environmental test on the container orchestration environment in the container data to obtain a test result; when it is determined that the test result is used to indicate that the container orchestration environment is normal, determining the container load capacity from the container data; and when it is determined that the container load capacity is greater than a preset load capacity, sending the container data to the front-end page.
[0012] According to another aspect of an embodiment of the present application, a method for transmitting page data is also provided, including: sending an initialization instruction to the middleware in response to a data display request of a target object; receiving feedback information sent by the middleware after completing initialization based on the initialization instruction, wherein the feedback information includes at least container data of the application; sending a call instruction generated based on the feedback information to the middleware; receiving page data in a unified format sent by the middleware based on the call instruction, wherein the page data is page data required for page display by a front-end page.
[0013] According to another aspect of an embodiment of the present application, a page data transmission device is also provided, including: an acquisition module, used to acquire container data of an application after initialization is completed based on an initialization instruction of a front-end page, wherein the container data represents data of the application after containerization configuration; a first sending module, used to send the container data to the front-end page; an execution module, used to execute the calling instruction upon receiving a calling instruction generated by the front-end page based on the container data, so as to acquire page data required for page display by the front-end page from the application, and transmit the page data in a unified format to the front-end page.
[0014] According to another aspect of an embodiment of the present application, a page data transmission device is also provided, including: a second sending module, used to send an initialization instruction to the middleware in response to a data display request of a target object; a first receiving module, used to receive feedback information sent by the middleware after completing initialization based on the initialization instruction, wherein the feedback information at least includes container data of the application; a third sending module, used to send a call instruction generated based on the feedback information to the middleware; a second receiving module, used to receive page data in a unified format sent by the middleware based on the call instruction, wherein the page data is page data required for page display by a front-end page.
[0015] According to another aspect of the embodiments of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0016] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned page data transmission method when running.
[0017] According to another aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the page data transmission method through the computer program.
[0018] In an embodiment of the present application, after initialization is completed based on the initialization instruction of the front-end page, the container data of the application is obtained, wherein the container data represents the data of the application after containerization configuration; the container data is sent to the front-end page; upon receiving a call instruction generated by the front-end page based on the container data, the call instruction is executed to obtain the page data required for the front-end page to display the page from the application, and transmit the page data in a unified format to the front-end page; the above-mentioned technical solution is adopted to solve the technical problem of how to improve the transmission efficiency when transmitting the page data to the front-end page, thereby improving the transmission efficiency of the page data. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0020] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0021] Figure 1 It is a schematic diagram of the hardware environment of a method for transmitting page data in an embodiment of the present application;
[0022] Figure 2 is a flow chart of a method for transmitting page data according to an embodiment of the present application;
[0023] Figure 3 is a flow chart of another method for transmitting page data according to an embodiment of the present application;
[0024] Figure 4 is a timing diagram of a transmission process of page data according to an embodiment of the present application;
[0025] Figure 5 is a structural block diagram of a device for transmitting page data according to an embodiment of the present application;
[0026] Figure 6 It is a structural block diagram of another device for transmitting page data according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] According to one aspect of an embodiment of the present application, a method for transmitting page data is provided. The method for transmitting page data is widely used in smart home (Smart Home), smart home, smart home device ecology, smart residential (Intelligence House) ecology and other whole-house intelligent digital control application scenarios, and the corresponding pages can be displayed in the applications corresponding to these application scenarios. Optionally, in this embodiment, the above-mentioned method for transmitting page data can be applied to Figure 1 In the hardware environment composed of the terminal device 102 and the server 104 shown in FIG. Figure 1 As shown, the server 104 is connected to the terminal device 102 via a network, and can be used to provide services (such as application services, etc.) for the terminal or a client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data computing services for the server 104.
[0030] The network may include but is not limited to at least one of the following: wired network, wireless network. The wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 102 may be but is not limited to a PC, a mobile phone, a tablet computer, a smart air conditioner, a smart range hood, a smart refrigerator, a smart oven, a smart stove, a smart washing machine, a smart water heater, a smart washing device, a smart dishwasher, a smart projection device, a smart TV, a smart clothes drying rack, a smart curtain, a smart audio and video, a smart socket, a smart speaker, a smart fresh air device, a smart kitchen and bathroom device, a smart bathroom device, a smart sweeping robot, a smart window cleaning robot, a smart mopping robot, a smart air purification device, a smart steamer, a smart microwave oven, a smart kitchen treasure, a smart purifier, a smart water dispenser, a smart door lock, etc.
[0031] In this embodiment, a method for transmitting page data is provided, which is applied to the middleware of the above server. Figure 2 : is a flow chart of a method for transmitting page data according to an embodiment of the present application, the process includes the following steps:
[0032] Step S202, after the initialization is completed based on the initialization instruction of the front-end page, the container data of the application is obtained, wherein the container data represents the data of the application after the containerization configuration;
[0033] Step S204, sending the container data to the front-end page;
[0034] Step S206, upon receiving a call instruction generated by the front-end page based on the container data, execute the call instruction to obtain the page data required for the front-end page to display the page from the application, and transmit the page data in a unified format to the front-end page.
[0035] Through the above steps, after the initialization is completed based on the initialization instruction of the front-end page, the container data of the application is obtained, wherein the container data represents the data of the application after containerization configuration; the container data is sent to the front-end page; when a call instruction generated by the front-end page based on the container data is received, the call instruction is executed to obtain the page data required for the front-end page to display the page from the application, and the page data in a unified format is transmitted to the front-end page, thereby solving the technical problem of how to improve the transmission efficiency when transmitting page data to the front-end page in the related technology, thereby improving the transmission efficiency of the page data.
[0036] Among them, since the compatibility of the same front-end page for different applications is not consistent, the data structure methods of different applications are also different, so the data formats of the page data of different applications are not consistent. If the corresponding processing format is called separately for each application to process the data, the processing process will be complicated and the processing workload will be large. The above middleware of the present application can use a pre-agreed unified format to encapsulate the page data of different applications when facing different applications, and return the encapsulated data with a unified format to the front-end page, so that the front-end page performs corresponding front-end interaction according to the page data, thereby improving the compatibility of page data of different applications.
[0037] It should be noted that the container data of the above application after containerization configuration represents a set of data that describes and defines the containerization configuration of the application. Containerization is a software engineering practice that packages an application and its dependencies into a lightweight, portable container. Different containers share the same operating system kernel at runtime, but each has its own file system, network, and process space. Containerization technologies such as Docker have become the standard for cloud-native applications.
[0038] For example, container data may include:
[0039] 1. Container Image: A container image is a lightweight, executable software package that contains the code, runtime, libraries, environment variables, and configuration files required to run an application, providing an independent and consistent operating environment for the application.
[0040] 2. Container Registry: A container registry is a service that stores and distributes container images. Common container registries include Docker Hub, Google Container Registry, Amazon Elastic Container Registry (ECR), etc.
[0041] 3. Container configuration: Container configuration includes instructions on how to run the container, such as environment variables, startup commands, network settings, storage volumes, etc.
[0042] 4. Container runtime: Container runtime is the software responsible for running containers, such as Docker Engine, containerd, CRI-O, etc.
[0043] 5. Container Orchestration: Container orchestration refers to the process of managing and coordinating multiple containers to ensure high availability, scalability, and load balancing of applications. Common container orchestration tools include Kubernetes, Docker Swarm, Amazon ECS, etc.
[0044] 6. Service Discovery: In a containerized environment, the service discovery mechanism allows containers to communicate with each other and load balance.
[0045] 7. Logging and Monitoring: Container data also includes application logging and monitoring data, which is critical for diagnosing problems and optimizing performance.
[0046] 8. Security: Container data also includes security-related configurations, such as container scanning, image signing, runtime security policies, etc.
[0047] Container data provides detailed information about the application runtime, which helps to better manage and maintain the application and is very important for development, deployment, and operation.
[0048] Optionally, in one embodiment, after obtaining the container data of the application, the middleware may perform container determination on the container data, that is, the middleware determines how to process the request or interact with other services according to the configuration and properties of the containerized application. Specifically, the determination process may include:
[0049] 1. Container identification: The middleware can identify and distinguish different container instances by reading the container’s metadata information, such as container ID, name, label, etc.
[0050] 2. Version determination: The middleware decides whether to forward the request or apply different processing logic based on the version number of the application container. For example, for an older version of the container, the middleware may redirect to a compatible processing path.
[0051] 3. Health check: The middleware needs to check whether the container is running healthy and active.
[0052] 4. Load balancing: In a container orchestration environment, the middleware needs to decide which container instance to route the request to based on the distribution and load of the container.
[0053] 5. Security check: The middleware needs to determine whether to allow the request to enter a specific container based on the security attributes of the container (such as security context, user ID, etc.).
[0054] 6. Resource limitations: The middleware decides whether to accept a request or limit the request rate based on the container’s resource limitations (such as CPU and memory quotas).
[0055] 7. Configuration adjustment: The middleware adjusts the way it handles requests based on the container configuration (such as environment variables, configuration files).
[0056] 8. Service routing: The middleware determines the routing path of the request based on the specific services provided by the container. For example, in a microservice architecture, the middleware may route requests to different containers based on the service name or API version.
[0057] 9. Logging and monitoring: The middleware makes decisions based on the container's log and monitoring information, such as adjusting the priority of request processing or triggering an alarm.
[0058] It can be seen that in actual applications, the middleware's judgment of container data may involve more complex logic and multiple steps. The specific implementation of these logics and steps depends on the design of the middleware and the requirements of the application.
[0059] In an exemplary embodiment, before executing the above-mentioned step S206 to transfer the page data with a unified format to the front-end page, a process for encapsulating the page data according to a pre-agreed encapsulation method is also proposed, including: converting the format of the page data to obtain first converted data, where the first converted data is a Blob object; obtaining first compressed data obtained by compressing the first converted data; encrypting the first compressed data to obtain first encrypted data, and determining the first encrypted data as the page data with a unified format.
[0060] Among them, Blob (Binary Large Object) is a data object used to represent a binary file.
[0061] Optionally, in this embodiment, a method of using a Blob object to encapsulate page data is proposed. Specifically, using a Blob object to encapsulate page data may include:
[0062] 1. Get the file object corresponding to the page data. 2. Convert the file object to a Blob object. 3. Compress and encrypt the Blob object. 4. During the upload process, use the encapsulated Blob object instead of the original file object. 5. Create an auxiliary function (such as FormData) to convert the Blob object to a FormData object for subsequent use.
[0063] In an exemplary embodiment, before executing the above-mentioned step S206 to transfer the page data with a unified format to the front-end page, other processes for encapsulating the page data in accordance with a pre-agreed encapsulation method are further proposed, including: converting the format of the page data to obtain second converted data, where the second converted data is an ArrayBuffer object; obtaining second compressed data obtained by compressing the second converted data; encrypting the second compressed data to obtain second encrypted data; converting the second encrypted data from the ArrayBuffer object to a Blob object, and determining the converted second encrypted data as the page data with a unified format.
[0064] Among them, ArrayBuffer is a class used to represent a general, fixed-length raw binary data buffer. ArrayBuffer itself cannot be directly manipulated and is usually used to create more specific typed array objects such as "Uint8Array" and "Int16Array", which can read and write data. In Web development, ArrayBuffer is often used to process large amounts of binary data, such as file uploads, Websocket communications, and other scenarios.
[0065] Optionally, in this embodiment, a method of using an ArrayBuffer object to encapsulate page data is proposed, which may specifically include:
[0066] 1. Get the file object corresponding to the page data. 2. Read the file content as ArrayBuffer: Read the file content and convert it into a typed array object of ArrayBuffer. 3. Perform operations such as compression and encryption on the typed array object. 4. Convert the typed array object after the operation back to a Blob object for uploading. 5. Create a helper function (such as FormData) to convert the Blob object into a FormData object for subsequent use.
[0067] The encapsulation method provided in the above embodiment can improve the integrity and consistency of page data during transmission. The specific method to be used depends on the project requirements and the required file operations. For example, if complex processing of file content is required, it may be more appropriate to use ArrayBuffer. If you just want to simply encapsulate the file, it may be more convenient to use a Blob object.
[0068] In an exemplary embodiment, initialization can be performed in the following manner: determining an initialization configuration file from the initialization instruction; determining a front-end framework corresponding to the front-end page, and determining a configuration path of the front-end framework; storing the initialization configuration file to the configuration path to complete initialization.
[0069] Optionally, in one embodiment, the initialization process may further include the following steps:
[0070] 1. Choose frameworks and libraries: Choose appropriate front-end frameworks (such as React, Vue, Angular, etc.) and libraries for file upload (such as Multer, FilePond, etc.) according to project requirements.
[0071] 2. Set up the project structure: Create a new front-end project, or add necessary folders and files to an existing project.
[0072] 3. Install dependencies: Run the "npm install" or "yarn add" command in the project's root directory to install the required frameworks and libraries.
[0073] 4. Configure middleware: In the project’s configuration file (such as React’s `index.js` or Express’s `app.js`), import and configure the file upload middleware.
[0074] In an exemplary embodiment, different solutions are proposed to implement the above-mentioned step S204 of sending the container data to the front-end page, specifically including:
[0075] Solution 1, determining the current program version number of the application from the container data; when it is determined that the current program version number is higher than the default program version number, sending the container data to the front-end page; when it is determined that the current program version number is lower than the default program version number, redirecting the container data to a compatible processing path; updating the container data under the compatible processing path to update the current program version number of the application to the default program version number, and sending the updated container data to the front-end page.
[0076] The default program version number may be understood as indicating the latest version of the most recent update, for example. If the current program version number is higher than the latest version, the data is sent based on the current program version number.
[0077] Solution 2: determining the running status of the application from the container data; and when it is determined that the running status is healthy, performing an environmental test on the container orchestration environment in the container data to obtain a test result; when it is determined that the test result indicates that the container orchestration environment is normal, determining the container load capacity from the container data; and when it is determined that the container load capacity is greater than a preset load capacity, sending the container data to the front-end page.
[0078] Furthermore, in this embodiment, a method for transmitting page data is provided, which is applied to the front-end page end of the above server. Figure 3 is a flow chart of another method for transmitting page data according to an embodiment of the present application, the flow includes the following steps:
[0079] Step S302, in response to the data display request of the target object, sending an initialization instruction to the middleware;
[0080] Step S304, receiving feedback information sent by the middleware after completing initialization based on the initialization instruction, wherein the feedback information at least includes container data of the application program;
[0081] Step S306, sending the call instruction generated based on the feedback information to the middleware;
[0082] Step S308, receiving page data in a unified format sent by the middleware based on the calling instruction, wherein the page data is page data required for the front-end page to display the page.
[0083] It is understandable that the front-end page further decapsulates the encapsulated page data in a unified format and displays the page data to the user.
[0084] Through the above steps, an initialization instruction is sent to the middleware in response to the data display request of the target object; feedback information sent by the middleware after completing the initialization based on the initialization instruction is received, wherein the feedback information at least includes the container data of the application; a call instruction generated based on the feedback information is sent to the middleware; page data in a unified format sent by the middleware based on the call instruction is received, and the front-end page can directly obtain the encapsulated page data from the middleware, and then use the page data to perform front-end interaction processes such as page display. The technical problem of how to improve the transmission efficiency when transmitting page data to the front-end page is solved based on the middleware, thereby improving the interaction efficiency of the front-end page.
[0085] Furthermore, in one embodiment, for security reasons, the front-end page may perform necessary security checks during the upload process, such as verifying the file type, size limit, user permissions, etc., to prevent potential security risks.
[0086] In order to better understand the process of the above-mentioned page data transmission method, the implementation method flow of the above-mentioned page data transmission is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.
[0087] In this embodiment, a method for transmitting page data is provided. Figure 4 is a timing diagram of a transmission process of page data according to an embodiment of the present application, such as Figure 4 As shown, the specific steps are as follows:
[0088] Step S401: The user enters the H5 page (ie, the front-end page) that requires the file upload function.
[0089] Step S402: The H5 page initiates an initialization request to the middleware to initialize the middleware.
[0090] Step S403: the middleware requests initial resources from the application software (eg, WeChat or WeChat applet).
[0091] Step S404: the middleware obtains the container data of the application software and performs container determination.
[0092] Step S405: The middleware is initialized successfully.
[0093] In this step, after initializing the middleware, the middleware obtains the information of the container corresponding to the application software, makes a judgment on the container, and returns the container data to H5.
[0094] Step S406: The H5 page triggers a data upload event.
[0095] Step S407: calling the method of the middleware, that is, after executing the upload event, H5 calls the method of the middleware according to the container data to call the upload function of the middleware.
[0096] Step S408: the middleware calls the native upload event.
[0097] In step S408, native upload events may be uniformly used for uploading for different software, thereby reducing the probability of upload failure caused by the inconsistency of the formats of upload events of different software programs.
[0098] Step S409: the middleware obtains the file information selected by the user to upload.
[0099] Step S410: The middleware encapsulates the data, thereby organizing the data into a unified format.
[0100] Step S411: The middleware sends the sorted data to the H5 page.
[0101] Step S412: H5 interacts with the user on the front end based on the data. After the upload is successful, the front end can display a success message, update the UI, and so on.
[0102] Through the above steps, the middleware can be initialized first, and the currently used container data can be obtained. Then, after the user performs the upload action, the middleware method can be called to enable the middleware to call the native upload function. In this way, after the user selects the file, the middleware obtains the data of the file selected by the user, and then encapsulates the obtained file data into a unified format, and then returns the encapsulated data with a unified format to H5. After H5 obtains the file data, it performs the corresponding front-end interaction. This embodiment can complete the initialization of the middleware and the process of uploading the file to the front-end. It should be noted that the specific implementation details may vary depending on the project requirements and technology stack.
[0103] In the above steps, using this middleware, multiple logics can be changed to one logic processing. Specifically, the middleware determines the system and container data of the mobile application, and uniformly encapsulates different container data to ensure that the file data structure of different mobile applications is the same, thereby improving the transmission efficiency when sending these file data to the front-end page. In addition, the code logic is optimized for the front-end, and the code readability and maintainability are also improved.
[0104] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0105] Figure 5 is a structural block diagram of a device for transmitting page data according to an embodiment of the present application. Figure 5 As shown, including:
[0106] An acquisition module 52, configured to acquire container data of the application after initialization is completed based on the initialization instruction of the front-end page, wherein the container data represents data of the application after containerization configuration;
[0107] A first sending module 54, used to send the container data to the front-end page;
[0108] The execution module 56 is used to execute the calling instruction generated by the front-end page based on the container data when receiving the calling instruction, so as to obtain the page data required for the front-end page to display the page from the application, and transmit the page data in a unified format to the front-end page.
[0109] Through the above-mentioned device, after the initialization is completed based on the initialization instruction of the front-end page, the container data of the application is obtained, wherein the container data represents the data of the application after containerization configuration; the container data is sent to the front-end page; when a call instruction generated by the front-end page based on the container data is received, the call instruction is executed to obtain the page data required for the front-end page to display the page from the application, and transmit the page data in a unified format to the front-end page, thereby solving the technical problem of how to improve the transmission efficiency when transmitting page data to the front-end page in the related art, thereby improving the transmission efficiency of the page data.
[0110] In an exemplary embodiment, the above-mentioned page data transmission device also includes an encapsulation module, which is used to perform format conversion on the page data with a unified format before transmitting the page data with a unified format to the front-end page to obtain first converted data, and the first converted data is a Blob object; obtain first compressed data obtained by compressing the first converted data; encrypt the first compressed data to obtain first encrypted data, and determine the first encrypted data as the page data with a unified format.
[0111] In an exemplary embodiment, the above-mentioned encapsulation module is also used to: perform format conversion on the page data to obtain second converted data, where the second converted data is an ArrayBuffer object; obtain second compressed data obtained by performing a compression operation on the second converted data; encrypt the second compressed data to obtain second encrypted data; convert the second encrypted data from the ArrayBuffer object to a Blob object, and determine the converted second encrypted data as the page data with a unified format.
[0112] In an exemplary embodiment, the above-mentioned page data transmission device also includes an initialization module, which is used to initialize in the following manner: determine an initialization configuration file from the initialization instruction; determine the front-end framework corresponding to the front-end page, and determine the configuration path of the front-end framework; store the initialization configuration file to the configuration path to complete the initialization.
[0113] In an exemplary embodiment, the first sending module 54 is also used to: determine the current program version number of the application from the container data; when it is determined that the current program version number is higher than the default program version number, send the container data to the front-end page; when it is determined that the current program version number is lower than the default program version number, redirect the container data to a compatible processing path; update the container data under the compatible processing path to update the current program version number of the application to the default program version number, and send the updated container data to the front-end page.
[0114] In an exemplary embodiment, the first sending module 54 is further used to: determine the running status of the application from the container data, and when it is determined that the running status is healthy, perform an environmental test on the container orchestration environment in the container data to obtain a test result; when it is determined that the test result indicates that the container orchestration environment is normal, determine the container load capacity from the container data; and when it is determined that the container load capacity is greater than a preset load capacity, send the container data to the front-end page.
[0115] Furthermore, in this embodiment, a device for transmitting page data is provided, which is applied to the front-end page of the above terminal device. Figure 6 is a structural block diagram of another device for transmitting page data according to an embodiment of the present application. Figure 6 As shown, specifically including:
[0116] A second sending module 62, configured to send an initialization instruction to the middleware in response to a data display request of a target object;
[0117] A first receiving module 64 is used to receive feedback information sent by the middleware after completing initialization based on the initialization instruction, wherein the feedback information at least includes container data of the application program;
[0118] A third sending module 66, configured to send a call instruction generated based on the feedback information to the middleware;
[0119] The second receiving module 68 is used to receive page data in a unified format sent by the middleware based on the calling instruction, wherein the page data is page data required for the front-end page to display the page.
[0120] Through the above device, in response to the data display request of the target object, an initialization instruction is sent to the middleware; feedback information sent by the middleware after completing the initialization based on the initialization instruction is received, wherein the feedback information at least includes the container data of the application; a call instruction generated based on the feedback information is sent to the middleware; page data in a unified format sent by the middleware based on the call instruction is received, and the front-end page can directly obtain the packaged page data from the middleware, and then use the page data to perform front-end interaction processes such as page display. Based on the middleware, the technical problem of how to improve the transmission efficiency when transmitting page data to the front-end page is solved, thereby improving the interaction efficiency of the front-end page.
[0121] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.
[0122] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:
[0123] S1, after completing the initialization based on the initialization instruction of the front-end page, obtaining the container data of the application, wherein the container data represents the data of the application after the containerization configuration;
[0124] S2, sending the container data to the front-end page;
[0125] S3, upon receiving a calling instruction generated by the front-end page based on the container data, execute the calling instruction to obtain the page data required for the front-end page to display the page from the application, and transmit the page data in a unified format to the front-end page.
[0126] Alternatively, in this embodiment, the storage medium may also be configured to store program codes for executing the following steps:
[0127] S1, in response to the data display request of the target object, sending an initialization instruction to the middleware;
[0128] S2, receiving feedback information sent by the middleware after completing initialization based on the initialization instruction, wherein the feedback information at least includes container data of the application program;
[0129] S3, sending a call instruction generated based on the feedback information to the middleware;
[0130] S4, receiving page data in a unified format sent by the middleware based on the calling instruction, wherein the page data is page data required for the front-end page to display the page.
[0131] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0132] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0133] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0134] S1, after completing the initialization based on the initialization instruction of the front-end page, obtaining the container data of the application, wherein the container data represents the data of the application after the containerization configuration;
[0135] S2, sending the container data to the front-end page;
[0136] S3, upon receiving a calling instruction generated by the front-end page based on the container data, execute the calling instruction to obtain the page data required for the front-end page to display the page from the application, and transmit the page data in a unified format to the front-end page.
[0137] Alternatively, in this embodiment, the processor may also be configured to perform the following steps through a computer program:
[0138] S1, in response to the data display request of the target object, sending an initialization instruction to the middleware;
[0139] S2, receiving feedback information sent by the middleware after completing initialization based on the initialization instruction, wherein the feedback information at least includes container data of the application program;
[0140] S3, sending a call instruction generated based on the feedback information to the middleware;
[0141] S4, receiving page data in a unified format sent by the middleware based on the calling instruction, wherein the page data is page data required for the front-end page to display the page.
[0142] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0143] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0144] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0145] The embodiments of the present application also provide a computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any one of the above method embodiments.
[0146] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0147] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0148] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for transmitting page data, characterized in that: include: After the initialization is completed based on the initialization instruction of the front-end page, the container data of the application is obtained, wherein the container data represents the data of the application after the containerization configuration; Sending the container data to the front-end page; When receiving a calling instruction generated by the front-end page based on the container data, the calling instruction is executed to obtain the page data required for the front-end page to display the page from the application, and the page data in a unified format is transmitted to the front-end page.
2. The method for transmitting page data according to claim 1, characterized in that: Before transmitting the page data having a unified format to the front-end page, the method further includes: The page data is packaged according to a pre-agreed packaging method, including: Performing format conversion on the page data to obtain first converted data, where the first converted data is a Blob object; Acquire first compressed data obtained by performing a compression operation on the first converted data; The first compressed data is encrypted to obtain first encrypted data, and the first encrypted data is determined as the page data having a unified format.
3. The method for transmitting page data according to claim 1, characterized in that: Before transmitting the page data having a unified format to the front-end page, the method further includes: The page data is packaged according to a pre-agreed packaging method, including: Performing format conversion on the page data to obtain second converted data, where the second converted data is an ArrayBuffer object; Acquire second compressed data obtained by performing a compression operation on the second converted data; encrypting the second compressed data to obtain second encrypted data; The second encrypted data is converted from the ArrayBuffer object into a Blob object, and the converted second encrypted data is determined as the page data having a unified format.
4. The method for transmitting page data according to claim 1, characterized in that: Initialize it in the following way: Determining an initialization configuration file from the initialization instruction; Determine the front-end framework corresponding to the front-end page, and determine the configuration path of the front-end framework; The initialization configuration file is stored in the configuration path to complete the initialization.
5. The method for transmitting page data according to claim 1, characterized in that: Sending the container data to the front-end page includes: Determining a current program version number of the application from the container data; If it is determined that the current program version number is higher than the default program version number, sending the container data to the front-end page; If it is determined that the current program version number is lower than the default program version number, redirecting the container data to a compatible processing path; The container data is updated under the compatible processing path to update the current program version number of the application program to a default program version number, and the updated container data is sent to the front-end page.
6. The method for transmitting page data according to claim 1, characterized in that: Sending the container data to the front-end page includes: Determining the running state of the application from the container data, and when determining that the running state is healthy, performing an environmental test on the container orchestration environment in the container data to obtain a test result; In a case where it is determined that the test result indicates that the container orchestration environment is normal, determining a container load capacity from the container data; When it is determined that the container load capacity is greater than the preset load capacity, the container data is sent to the front-end page.
7. A method for transmitting page data, characterized in that: include: In response to a data display request from a target object, an initialization instruction is sent to the middleware; receiving feedback information sent by the middleware after completing initialization based on the initialization instruction, wherein the feedback information at least includes container data of the application program; Sending a call instruction generated based on the feedback information to the middleware; Receive page data in a unified format sent by the middleware based on the calling instruction, wherein the page data is page data required for the front-end page to display the page.
8. A device for transmitting page data, characterized in that: include: An acquisition module, used to acquire container data of the application after initialization is completed based on the initialization instruction of the front-end page, wherein the container data represents data of the application after containerization configuration; A first sending module, used to send the container data to the front-end page; An execution module is used to execute the calling instruction generated by the front-end page based on the container data when receiving the calling instruction, so as to obtain the page data required for the front-end page to display the page from the application, and transmit the page data in a unified format to the front-end page.
9. A device for transmitting page data, characterized in that: include: A second sending module, configured to send an initialization instruction to the middleware in response to a data display request of a target object; A first receiving module, configured to receive feedback information sent by the middleware after completing initialization based on the initialization instruction, wherein the feedback information at least includes container data of the application program; A third sending module, configured to send a call instruction generated based on the feedback information to the middleware; The second receiving module is used to receive page data in a unified format sent by the middleware based on the calling instruction, wherein the page data is page data required for the front-end page to display the page.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
WEB terminal controlled message middleware system and data transmission method thereof
CN105472042A
Animation playing method and device, computer equipment and storage medium
CN110647703A
Data transmission method and device, electronic equipment and storage medium
CN111162879A
Page rendering method and device, electronic equipment and computer readable medium
CN111984888A
Terminal application updating method and device, storage medium and electronic equipment
CN112631638A
