WO2022267797A1 - 一种报文生成方法及装置 - Google Patents

一种报文生成方法及装置 Download PDF

Info

Publication number
WO2022267797A1
WO2022267797A1 PCT/CN2022/094662 CN2022094662W WO2022267797A1 WO 2022267797 A1 WO2022267797 A1 WO 2022267797A1 CN 2022094662 W CN2022094662 W CN 2022094662W WO 2022267797 A1 WO2022267797 A1 WO 2022267797A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
node
client
combination
picture
Prior art date
Application number
PCT/CN2022/094662
Other languages
English (en)
French (fr)
Inventor
栾佳
傅宇文
刘心晖
孔大超
耿贤辈
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022267797A1 publication Critical patent/WO2022267797A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45529Embedded in an application, e.g. JavaScript in a Web browser
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45554Instruction set architectures of guest OS and hypervisor or native processor differ, e.g. Bochs or VirtualPC on PowerPC MacOS
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/03Protocol definition or specification 

Definitions

  • the application relates to a method for generating a message, in particular to a method and device for generating a message displayed on a client.
  • the client application program When the client application program displays the message content file and JavaScript file (JavaScript, referred to as JS) obtained from the server, the client first runs the JS file to generate a virtual text object model (Document Object Model, referred to as DOM) interface; through Parse the virtual DOM structure and compare it with the local cache DOM interface to generate a rendering instruction, and then convert the virtual DOM interface into a display component according to the rendering instruction to display the message.
  • JS JavaScript
  • DOM virtual text object model
  • the number of elements in the message and the nesting structure will affect the rendering delay, occupy a lot of memory, and affect the user experience.
  • the present application provides a message generation method and device, which can reduce display time and memory usage, and improve user experience.
  • the first aspect of the present application provides a method for generating a message, including: generating a first message based on a client request message, the first message is a tree structure including a plurality of nodes; obtaining the first A picture corresponding to the first node among the multiple nodes in the message; using the picture to replace the first node in the first message to generate a second message; sending the second message to the client.
  • the picture corresponding to the first node in the first message when obtaining the picture corresponding to the first node in the first message, it specifically includes: obtaining the complexity of the first node combination composed of the first nodes; When the degree is greater than the first threshold, obtain the picture corresponding to the first node combination.
  • replacing the first node in the first message with a picture to generate the second message it specifically includes: replacing the combination of the first nodes in the first message with a corresponding picture to generate the second message.
  • the picture corresponding to the first node combination is used to replace the first node combination in the first message, which makes the message structure simpler and avoids the use of pictures to replace
  • the simple combination of the first node further reduces the resource consumption of the client when displaying, and improves the experience of the client.
  • the first node is a static node with fixed content.
  • the first node is limited to a static node with fixed content, so that the server only obtains pictures corresponding to the static node or its combination, reducing server resources.
  • the second message by replacing the first node in the first message with the corresponding picture when generating the second message by replacing the first node in the first message with the corresponding picture, it specifically includes: obtaining the type information of the client; according to the type information Determine the number of users corresponding to the client type; when the number of users is greater than a second threshold, replace the first node in the first message with the corresponding picture to generate a second message.
  • the number of user groups of each client type in the first node combination is counted.
  • the picture corresponding to the first node combination is used to replace the first node combination, reducing The resource consumption of the user group when displaying the first node combination improves the experience of the client; at the same time, the threshold of the number of user groups is set, so that the server can timely clear the pictures in the server that do not reach the number of users, and reduce the resource consumption of the server.
  • the type information of the client includes one or more of a client model, a client operating system version, or a client version.
  • the type of the client is determined, so that when the image corresponding to the first node or the combination of the first nodes is obtained, the corresponding image is obtained according to the type of the client, so that the corresponding image matches the client.
  • the first threshold is determined in the following manner: obtaining multiple first messages; calculating the difference in resource consumption of the first node combination in the multiple first messages and complexity, wherein the difference is based on the difference between the resource consumption amount occupied by the first node combination based on the first message display and the resource consumption amount occupied by the picture corresponding to the first node combination display; based on multiple first node combinations
  • the complexity and the difference determine the first threshold.
  • the first threshold of node complexity determined by the difference between the complexity of multiple first node combinations and the resource consumption, thus providing an accurate judgment when selecting a node combination with high complexity and using the corresponding picture for replacement standard.
  • the resource consumption is determined by one or more of memory occupied and display time combined by display nodes.
  • the complexity of the node combination is determined based on one or more of node layer number, node number, node complexity weight, and occupied pixel area of the node combination.
  • the complexity of the first node combination is comprehensively determined based on the number of node layers, number of nodes, node type and occupied pixel area, so as to provide a basis for accurately judging the first node combination that needs to be replaced with a picture.
  • the complex weight of a node is determined by a node type in a node combination.
  • the node complexity weight is determined based on the node type, so as to calculate the node complexity more accurately.
  • the second aspect of the present application provides a message generating device, including: a first message generating module, configured to generate a first message based on a request message from a client, and the first message includes multiple A tree structure of nodes; a picture acquisition module, configured to acquire a picture corresponding to the first node among the plurality of nodes in the first message; a message replacement module, used to replace the corresponding picture with the first node in the first message , to generate a second message; the message sending module is configured to send the second message to the client.
  • a first message generating module configured to generate a first message based on a request message from a client, and the first message includes multiple A tree structure of nodes
  • a picture acquisition module configured to acquire a picture corresponding to the first node among the plurality of nodes in the first message
  • a message replacement module used to replace the corresponding picture with the first node in the first message , to generate a second message
  • the message sending module is configured to send the second message to the client.
  • the image acquisition module is specifically configured to acquire the complexity of the first node combination composed of the first nodes; and is also specifically configured to acquire the complexity of the first node combination when the complexity is greater than the first threshold A picture corresponding to a node combination; the message replacement module is specifically used to replace the first node combination in the first message with a picture to generate a second message.
  • the picture corresponding to the first node combination is used to replace the first node combination in the first message, which makes the message structure simpler and avoids the use of pictures to replace
  • the simple combination of the first node further reduces the resource consumption of the client when displaying, and improves the experience of the client.
  • the first node is a static node with fixed content.
  • the first node is limited to a static node with fixed content, so that the server only obtains pictures corresponding to the static node or its combination, reducing server resources.
  • the message replacement module is specifically used to obtain the type information of the client; and is also specifically used to determine the number of users corresponding to the type of the client according to the type information of the client; and is also specifically used to When the number of users is greater than the second threshold, the corresponding picture is used to replace the first node in the first message to generate the second message.
  • the number of user groups of each client type in the first node combination is counted.
  • the picture corresponding to the first node combination is used to replace the first node combination, reducing The resource consumption of the user group when displaying the first node combination improves the experience of the client; at the same time, the threshold of the number of user groups is set, so that the server can timely clear the pictures in the server that do not reach the number of users, and reduce the resource consumption of the server.
  • the type information of the client includes one or more of a client model, a client operating system version, or a client version.
  • the type of the client is determined, so that when the image corresponding to the first node or the combination of the first nodes is obtained, the corresponding image is obtained according to the type of the client, so that the corresponding image matches the client.
  • it further includes a first threshold generation device, configured to obtain multiple first messages; and also used to calculate the first node combination in the multiple first messages
  • the difference and complexity of resource consumption where the difference is the difference between the resource consumption occupied by the first node combination based on the first message and the resource consumption occupied by the corresponding picture; and is also used based on The difference between the complexity and the resource consumption of the multiple first nodes is used to determine the first threshold.
  • the first threshold of node complexity determined by the difference between the complexity of multiple first node combinations and the resource consumption, thus providing an accurate judgment when selecting a node combination with high complexity and using the corresponding picture for replacement standard.
  • the resource consumption amount is determined by one or more items of occupied memory and display time of a combination of display nodes.
  • the complexity is determined based on one or more of node layer number, node number, node complexity weight, and occupied pixel area of the node combination.
  • the complexity of the first node combination is comprehensively determined based on the number of node layers, number of nodes, node type and occupied pixel area, so as to provide a basis for accurately judging the first node combination that needs to be replaced with a picture.
  • the node complex weight is determined by the node type in the node combination.
  • the node complexity weight is determined based on the node type, so as to calculate the node complexity more accurately.
  • the third aspect of the present application provides a computing device, including a processor and a memory, the memory stores program instructions, and when the program instructions are executed by the processor, the processor executes the application described in the first aspect of the application. Text generation method.
  • the fourth aspect of the present application provides a storage medium on which program instructions are stored.
  • the program instructions are executed by a computer
  • the computer executes the message generation method of the first aspect of the application.
  • the fifth aspect of the present application provides a computer program product, which includes program instructions, which when executed by a computer cause the computer to execute the message generation method of the first aspect of the present application.
  • FIG. 1A is a schematic structural diagram of the application system of each embodiment of the present application.
  • Fig. 1B is a schematic diagram of the card display content of the negative screen of the mobile phone according to the embodiment of the present application;
  • FIG. 2A is a schematic flow diagram of Embodiment 1 of the method of the present application.
  • FIG. 2B is a schematic structural diagram of a first message of a weather query service
  • FIG. 3A is a schematic flow diagram of Embodiment 2 of the method of the present application.
  • FIG. 3B is a schematic flow diagram of the image acquisition method in Embodiment 2 of the method of the present application.
  • FIG. 4 is a schematic flowchart of an embodiment of a first threshold determination method in Embodiment 2 of the method of the present application;
  • FIG. 5A is a schematic flow chart of Embodiment 3 of the method of the present application.
  • FIG. 5B is a schematic flow chart of the image replacement method in Embodiment 3 of the method of the present application.
  • Fig. 6 is a structural schematic diagram of the first implementation of the device of the present application.
  • Fig. 7 is a schematic structural diagram of the second implementation of the device of the present application.
  • FIG. 8 is a structural diagram of the first threshold determination module of the second implementation of the device of the present application.
  • Fig. 9 is a schematic structural diagram of the third implementation of the device of the present application.
  • FIG. 10A is a schematic flow diagram of a specific embodiment of the present application.
  • FIG. 10B is a schematic diagram of three first node combinations of the first message in the specific implementation manner of the present application.
  • FIG. 10C is a schematic diagram of the corresponding relationship between joint key values and pictures in the specific implementation manner of the present application.
  • FIG. 10D is a schematic diagram of the content of the first message in the specific implementation manner of the present application.
  • FIG. 10E is a schematic diagram of the content of the second message in the specific implementation manner of the present application.
  • FIG. 10F is a schematic diagram of the display content of the second message in the specific implementation manner of the present application.
  • FIG. 11 is a schematic structural diagram of an embodiment of a computing device of the present application.
  • the embodiment of the present application proposes a method and device for generating a message. By segmenting the message and replacing several divided contents with pictures, the display time and memory usage are reduced, and the user experience is improved.
  • FIG. 1A shows an application system applied by the embodiment of the present application, including a server 1 , a client 3 and a network 2 .
  • the client 3 can be a mobile terminal such as a mobile phone or a tablet computer, or a computer such as a personal computer, and is used to display message content.
  • the display mode includes at least a web page, an application program, and a card with one screen negative of the mobile phone.
  • FIG. 1B shows that the mobile phone Negative one-screen card display mode.
  • Server 1 is used to generate a message based on a message request from a client, and may be a cloud server, a local server, a physical server, or a virtual server.
  • the network 2 is used to transmit messages between the server 1 and the client 3, and the network 2 may be a wired network or a wireless network or a mixture of the two.
  • This embodiment provides a method for generating a message, and the method for generating a message can be executed by the server 1 .
  • the first message is generated based on the message request of the client, and the static node is replaced with the picture corresponding to the static node in the first message, which reduces the resource consumption of the client 3 during display and improves the experience of the client 3 .
  • FIG. 2A shows the flow of the method embodiment, which includes the following steps:
  • the message requested by the client 3 is used for displaying on the client 3 .
  • the client 3 requests a message from the server 1 based on a service, and the requested message corresponds to the service content.
  • FIG. 2B shows an example of a first message of a weather query service
  • the left side shows the weather content viewed by the client
  • the right side shows the tree structure of the corresponding first message.
  • the first layer of the first message has two nodes, which are respectively the node of the day (maininfor in Figure 2B) and the weather forecast node (weatherforecast in Figure 2B), corresponding to the weather of the day and the weather from the day of the inquiry respectively.
  • the weather for 5 consecutive days starting from the previous day wherein the node of the day includes a time node (realtime in Figure 2B) and a weather node of the day (allday in Figure 2B), which correspond to the specific time and weather of the day when checking the day;
  • the weather prediction node includes 5 day nodes (marked as 0, 1, 2 in Figure 2B, of which 3 and 4 are not marked), corresponding to the weather conditions of 5 consecutive days starting from the previous day of the query day, each day
  • the node includes 4 nodes, namely date, week, weather and temperature nodes (respectively Date, Week, url and Temperature in Figure 2B), wherein the weather node is in the form of a picture.
  • this node is also the first node.
  • the node of the day corresponds to the specific time and weather of the day when it is checked that day. Because the specific time keeps changing, the time node is not the first node, and the day node including the time node is not the first node either.
  • the date, week, weather and temperature corresponding to each day node in the weather forecast node are unchanged, so the 4 nodes included in each day node are the first nodes, and each day node is also the second One node, the weather forecast node is the first node.
  • the picture corresponding to the first node includes all display contents corresponding to the first node. In some embodiments, when the picture corresponding to the first node does not exist, the picture is created.
  • the adapted picture is also selected based on the type of the client terminal, so as to meet the requirements of different terminals.
  • the message corresponding to the first node in the first message is replaced with the network address (Uniform Resource Locator, URL) of the picture corresponding to the first node.
  • URL Uniform Resource Locator
  • the static nodes have been replaced by pictures, and the structure of the second message is simple, and the client 3 does not need to analyze the DOM of the message and generate the display component when displaying the message.
  • method embodiment 1 generates the first message based on the message request of the client 3, replaces the static node with the picture corresponding to the static node in the first message, generates the second message, and sends it to the client 3. Because the structure of the second message is simple, the client 3 does not need to perform complex message DOM parsing and display component generation when displaying, which reduces the resource consumption of the client 3 when displaying complex messages and improves the experience of the client 3.
  • This embodiment provides a method for generating a message, and the method for generating a message can be executed by the server 1 .
  • Method Embodiment 2 On the basis of method embodiment 1, the static nodes are combined, and when the complexity of the node combination composed of several static nodes in the first message is greater than the set threshold, the image corresponding to the static node combination is used Replacing the static node combination further reduces the resource consumption of the client 3 during display and improves the experience of the client 3 .
  • Fig. 3A shows the process of method embodiment 2. Compared with the process of method embodiment 1, it replaces steps 220 and S230 in method embodiment 1 with steps S222 and S232 respectively, and the changed steps are mainly introduced below:
  • each sky node in the weather prediction node is the first node, and all directly belong to the weather prediction node, wherein any number of consecutive sky nodes form the first node combination.
  • the first node combination is multiple. In some embodiments, when the complexity of the first node combination is greater than a set threshold, its corresponding picture is obtained.
  • the picture corresponding to the first node combination is obtained, and the first node combination in the first message is replaced in the subsequent steps, so that the message structure is simpler.
  • the client 3 displays the simple first node combination by displaying the corresponding picture, the resources consumed will not be reduced.
  • the picture corresponding to the first node combination is obtained, thereby Avoid using images instead of simple first-node combinations.
  • replacing the first node combination with the picture corresponding to the first node combination whose complexity is greater than the set threshold further reduces the resource consumption of the client 3 when displaying, and improves the experience of the client 3 .
  • the picture acquisition method in the second method embodiment acquires the complexity of the first node combination, and acquires the corresponding picture when the complexity of the first node combination is greater than the set threshold, so as to avoid using pictures to replace the simple first node combination.
  • Fig. 3B shows the flow of the image acquisition method of the second method embodiment, which includes the following steps:
  • the complexity of the node combination is determined based at least on the node layer number, node number, node complex weight and occupied pixel area of the first node combination, the more node layers or the more nodes Or when the occupied pixel area is reduced or the complex weight of the node is large, the complexity is greater.
  • the node complex weight of the node is determined based on the node type in the first node combination, the more picture nodes there are, the greater the node complex weight.
  • the complexity of the first node combination is comprehensively determined based on the number of node layers, number of nodes, node type and occupied pixel area, so as to provide a basis for accurately judging the first node combination that needs to be replaced with a picture.
  • the picture corresponding to the first node combination includes all display contents corresponding to the first node. In some embodiments, when the picture corresponding to the first node combination does not exist, the picture is created.
  • the adapted picture is also selected based on the type of the client terminal, so as to meet the requirements of different terminals.
  • the picture corresponding to the first node combination is acquired only when the complexity is greater than the set threshold, so as to avoid using pictures to replace the simple first node combination.
  • the resource consumption is determined by one or more of the occupied memory and display time of the display node combination estimated by the server 1 .
  • an example resource consumption calculation formula is as follows:
  • cost is the resource consumption of the message to be displayed displayed by the client 3;
  • m i is the memory occupied by the client 3 to display the message to be displayed, and
  • m basic is the basis occupied by the client 3 when displaying any message to be displayed Memory is related to the display environment of client 3 and has nothing to do with the message to be displayed.
  • m max is the maximum memory that can be occupied when client 3 displays any message to be displayed;
  • Occupancy time t basic is the basic time occupied by client 3 when displaying any message to be displayed, which is related to the display environment of client 3 and has nothing to do with the message to be displayed,
  • t max is the time when client 3 displays any message to be displayed The maximum amount of time a text can take.
  • the message to be displayed is a message corresponding to the node combination, which may be a message corresponding to the node combination in the first message, or a picture message corresponding to the node combination.
  • Fig. 4 shows the flow chart of the embodiment of the first threshold determination method, which includes the following steps:
  • the first node combination is a kind of node combination, which is a combination of static nodes.
  • the complexity of the node combination is determined based on one or more of the number of node layers, the number of nodes, the complex weight of the node and the occupied pixel area of the node combination, and the complex weight of the node is determined by the nodes in the node combination Type is determined.
  • An example complexity calculation formula is as follows:
  • f is the complexity of the node combination
  • h is the number of node layers of the node combination
  • n is the number of static nodes in the node combination
  • n is the node complex weight of the node combination, which is determined based on the ratio of the image nodes in the node combination
  • s is the pixel area of the node combination
  • k is a set constant.
  • the resource consumption is determined by one or more of the occupied memory and the display time of the display node combination estimated by the server 1 .
  • An example resource consumption calculation formula is as follows:
  • cost is the resource consumption of the message to be displayed displayed by the client 3;
  • m i is the memory occupied by the client 3 to display the message to be displayed, and
  • m basic is the basis occupied by the client 3 when displaying any message to be displayed Memory is related to the display environment of client 3 and has nothing to do with the message to be displayed.
  • m max is the maximum memory that can be occupied when client 3 displays any message to be displayed;
  • Occupancy time t basic is the basic time occupied by client 3 when displaying any message to be displayed, which is related to the display environment of client 3 and has nothing to do with the message to be displayed,
  • t max is the time when client 3 displays any message to be displayed The maximum amount of time a text can take.
  • the message to be displayed is a message corresponding to the node combination, which may be a message corresponding to the node combination in the first message, or a picture message corresponding to the node combination.
  • S430 Determine a first threshold based on the difference between the complexity of each node combination and the resource consumption.
  • the first threshold is determined by fitting the relationship between the resource consumption difference of multiple node combinations and the complexity.
  • the complexity of the node combination is greater than the first threshold, the difference in resource consumption is greater than 0, that is, the resource consumption occupied by the node combination displayed based on the first message is greater than the resource consumption occupied by the corresponding picture.
  • the first threshold of node complexity is determined by the difference between the complexity of multiple node combinations and the resource consumption, so as to provide an accurate judgment standard when selecting a node combination with high complexity and replacing it with the corresponding picture.
  • method embodiment 2 is based on method embodiment 1, when the complexity of the first node combination is greater than the set threshold, the picture corresponding to the first node combination is used to replace the first node combination in the first message, The structure of the message is made simpler, and at the same time, the use of pictures to replace the simple combination of the first nodes is avoided, further reducing the resource consumption of the client 3 when displaying, and improving the experience of the client 3 .
  • This embodiment provides a method for generating a message, and the method for generating a message can be executed by the server 1 .
  • Method Embodiment 3 On the basis of Method Embodiment 2, when the number of users of the first node combination exceeds the set threshold, when the picture corresponding to the first node combination is used instead of the first node combination, the number of users who display the first node combination is reduced.
  • the resource consumption of a node combination improves the experience of the client 3 and reduces the resource consumption of the server 1 at the same time.
  • Figure 5A shows the process of the third method embodiment. Compared with the process of the second method embodiment, it uses S234 to replace the step 232 in the second method embodiment. The following focuses on this step:
  • the number of users corresponding to each type of client 3 is counted based on the type information of the client 3 combined by the first node, and when the number of users exceeds the set second threshold, the first node combination is used to correspond The picture of replaces the first node combination in the first packet.
  • the corresponding pictures saved in the server by the first node combination are cleaned up based on a least recently used policy (Least Recently Used, LRU).
  • LRU least Recently Used
  • the picture corresponding to the first node combination is used to replace the first node combination in the first message, and the corresponding picture stored in the server is based on the LRU strategy (Least Cleaning up, especially cleaning up the pictures corresponding to the first node combination whose number of users does not meet the second threshold, thereby improving the experience of the user group corresponding to the number of users while avoiding too much occupation of server resources.
  • LRU strategy Least Cleaning up, especially cleaning up the pictures corresponding to the first node combination whose number of users does not meet the second threshold, thereby improving the experience of the user group corresponding to the number of users while avoiding too much occupation of server resources.
  • FIG. 5B shows the flow of the picture replacement method in the third method embodiment, which includes the following steps:
  • the type information of the client 3 includes one or more of the model of the client 3 , the version of the operating system of the client 3 or the version of the client 3 .
  • the type of the client 3 is determined based on the detailed type information of the client 3 , so as to provide a basis for accurate statistics of the user groups of each client 3 .
  • S2320 Determine the number of users corresponding to each type of client 3 according to the type information of the client 3 .
  • the number of users of the first node combination is counted, so as to determine the user group of each client 3 of the first node combination.
  • method embodiment three counts the number of user groups of each client 3 types combined by the first node on the basis of method embodiment 2, and when the number of user groups of 3 types of a client exceeds the set threshold, the third When the picture corresponding to a node combination replaces the first node combination, the resource consumption of the user group when displaying the first node combination is reduced, the experience of the client 3 is improved, and the resource consumption of the server 1 is reduced.
  • Figure 6 shows a schematic structural diagram of the first embodiment of the device, which includes the following modules:
  • the first message generation module 610 is configured to generate a first message based on the request message of the client 3, where the first message is a tree structure including multiple nodes.
  • the first message is a tree structure including multiple nodes.
  • the picture obtaining module 620 is configured to obtain a picture corresponding to the first node among the multiple nodes in the first message.
  • the message replacement module 630 is configured to replace the first node in the first message with the picture corresponding to the first node to generate a second message.
  • a message sending module 640 configured to send the second message to the client 3.
  • step S240 of [Method Embodiment 1].
  • Fig. 7 shows a schematic diagram of the structure of the device embodiment 2. Compared with the structure of the device embodiment 1, it uses a picture acquisition module 622 and a message replacement module 632 to replace the picture acquisition module 620 and the message replacement module 632 in the device embodiment 1 respectively.
  • Module 630 the modules that change are highlighted below:
  • the image acquisition module 622 is configured to acquire the image corresponding to the first node combination among the plurality of nodes in the first message, specifically to acquire the first node combination and its complexity formed by the first nodes, and also specifically to acquire the first node combination and its complexity in the first message When the complexity of the first node combination is greater than the first threshold, a picture corresponding to the first node combination is acquired.
  • step S222 of [method embodiment 2] please refer to step S222 of [method embodiment 2].
  • the complexity of the first node combination is determined through [the first threshold determination module].
  • a message replacement module 632 configured to replace the first node combination in the first message with its corresponding picture to generate a second message.
  • a message replacement module 632 configured to replace the first node combination in the first message with its corresponding picture to generate a second message.
  • Fig. 8 shows the structure of the first threshold determination module, which includes the following modules:
  • An acquiring module 810 configured to acquire multiple first packets.
  • the calculation module 820 is configured to calculate the difference and complexity of the resource consumption of the first node combination in the multiple first messages, wherein the resource consumption difference is based on the first message showing the occupation of the first node combination The difference between the resource consumption of , and the resource consumption occupied by displaying the picture corresponding to the first node combination.
  • step S420 of [the first threshold determination method embodiment] For its detailed working principles and beneficial technical effects, please refer to step S420 of [the first threshold determination method embodiment].
  • a determining module 830 configured to determine a first threshold based on the difference between the combined complexity and resource consumption of multiple first nodes. For its detailed working principle and beneficial technical effects, please refer to step S430 of [the embodiment of the method for determining the first threshold].
  • Fig. 9 shows a schematic structural diagram of the third device embodiment.
  • the message replacement module 634 is used to replace the message replacement module 632 in the second device embodiment. The following focuses on this module:
  • the message replacement module 634 is configured to replace the first node combination with its corresponding picture based on the number of users of the first node combination in the first message, so as to generate a second message. It is specifically used to obtain the type information of the client 3 of the first node combination, and is also specifically used to determine the number of users corresponding to each type of client 3 according to the type information of the client 3, and is also specifically used when any client When the number of users corresponding to the type of the end is greater than the second threshold, the picture corresponding to the first node combination is used to replace the first node combination in the first message to generate a second message.
  • step S234 of [Method Embodiment 3].
  • FIG. 10A shows the flow of a specific embodiment of the message generating method of the present application, which includes the following steps.
  • the message request of the client 3 in this specific embodiment is a message request of a service card with one negative screen on the mobile phone.
  • the three first node combinations shown in FIG. 10B are:
  • the first node combination is selected branch by branch from the trunk of the first message; when the nodes on a branch are all static nodes, the nodes of the entire branch are selected to form the first node combination; and if There are successively adjacent first node combinations on the same level, then merge them to generate a large first node combination, and select the new first node combination; when the nodes on a branch are not all static nodes, Then enter the next level from this tree branch, and carry out the same selection to the lower layer sub-branches of this tree branch with the above-mentioned same method. Using this top-down method realizes optimal segmentation of the first message to obtain first node combinations.
  • the joint key value includes at least the identifier of the first message, the identifier of the first node combination, and the identifier of the client device.
  • the identifier of the first message is used to distinguish the first message.
  • the first message is generated based on the message request of the same service card, which has the same message structure and corresponds to the service content structure of the service card.
  • the identifier of a message is also called a service ID;
  • the identifier of the first node combination corresponds to the message of the first node combination in the first message, and the message is also called a response message, and the identifier of the first node combination is also called In response to the message ID; the identification of the device is used to distinguish different client 3 device types, also known as the device ID.
  • FIG. 10C shows the correspondence between joint key values and pictures.
  • Fig. 10C takes the weather service card with one negative screen of the mobile phone as an example, which includes three first response messages, the first first response message corresponds to three types of terminal devices, and corresponds to three joint key values, Corresponding to three pictures.
  • step S1040 Based on the combined key value, it is judged whether the corresponding picture is queried in the server 1. Wherein, when the corresponding picture is found, go to step S1050, otherwise go to step S1070.
  • step S1050 Determine whether the number of users of the picture is greater than a second threshold. Wherein, if it is greater than the second threshold, go to step S1060, otherwise go to step S1080.
  • the number of users is the number of users who have queried pictures based on the joint key value, and there is a one-to-one correspondence between users and client devices.
  • the URL of the picture is used to replace the corresponding response message in the first message, so as to improve the user experience of the subsequent client 3.
  • server 1 when a large number of pictures are generated, a large amount of resources of server 1 will be occupied.
  • server 1 will clean up the expired pictures based on the LRU strategy, and set a reasonable second threshold.
  • Server 1 will clean up the number of users in time. The picture with the second threshold not only improves the experience of the user group corresponding to the picture, but also prevents the resources of the server 1 from being too much occupied.
  • the URL of the picture is used to replace the response message corresponding to the first node combination.
  • the client 3 displays the URL of the picture and occupies less resource consumption than displaying the response message.
  • the response message when the response message is displayed on the mobile phone, it needs to go through the detailed process of parsing the virtual DOM structure and converting the virtual DOM interface into a display component, which consumes a lot of resources; when displaying pictures, the above-mentioned process, occupying a small amount of resource consumption.
  • the created picture is stored in the server 1, and its URL and the corresponding joint key form a key-value pair, which is used for subsequent queries by other clients 3.
  • the accumulated number of users is used for comparison with the second threshold.
  • step S1090 Determine whether there is an unselected first node combination. If there is still an unselected first node combination, go to step S1030, otherwise go to step S1100.
  • step S1030 because the acquisition method of the first node combination from top to bottom is implemented in step S1030, the acquired first node combination will not intersect, which is an optimal segmentation strategy.
  • displaying the second message requires less resource consumption, and the user experience of the client 3 is better.
  • FIG. 10D shows an example of a first message, which is used to display sports game results on a mobile phone card. It has multiple node contents, complex structure, complex display process, and large resource consumption.
  • Fig. 10E shows an example of a second message
  • the corresponding first message is a first node combination
  • the entire second message is the corresponding picture URL
  • the message structure is simple
  • the display process is simple
  • the resource consumption is small.
  • Fig. 10F shows an example of the second message displayed on the mobile phone.
  • the results of the completed game are replaced by corresponding pictures, which are surrounded by boxes in the figure
  • the NBA All-Star game results and the Premier League game results consume less resources and display in a short time, which improves the user experience of the client 3.
  • FIG. 11 is a schematic structural diagram of a computing device 1100 provided by an embodiment of the present application.
  • the computing device 1100 includes: a processor 1110 , a memory 1120 , and a communication interface 1130 .
  • the communication interface 1130 in the computing device 1100 shown in FIG. 11 can be used to communicate with other devices.
  • the processor 1110 may be connected to the memory 1120 .
  • the memory 1120 can be used to store the program codes and data. Therefore, the memory 1120 may be an internal storage module of the processor 1110, or an external storage module independent of the processor 1110, or may include an internal storage module of the processor 1110 and an external storage module independent of the processor 1110. part.
  • the processor 1110 may use a central processing unit (central processing unit, CPU).
  • the processor can also be other general-purpose processors, digital signal processors (digital signal processors, DSPs), application specific integrated circuits (application specific integrated circuits, ASICs), off-the-shelf programmable gate arrays (field programmable gate arrays, FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the processor 1110 adopts one or more integrated circuits for executing related programs, so as to implement the technical solutions provided by the embodiments of the present application.
  • the memory 1120 may include read-only memory and random-access memory, and provides instructions and data to the processor 1110 .
  • a portion of processor 1110 may also include non-volatile random access memory.
  • processor 1110 may also store device type information.
  • the processor 1110 executes computer-implemented instructions in the memory 1120 to perform the operation steps of the above method.
  • the computing device 1100 may correspond to a corresponding subject in performing the methods according to the various embodiments of the present application, and the above-mentioned and other operations and/or functions of the modules in the computing device 1100 are for realizing the present invention For the sake of brevity, the corresponding processes of the methods in the embodiments are not repeated here.
  • the disclosed systems, devices and methods may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components can be combined or integrated. to another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • a unit described as a separate component may or may not be physically separated, and a component shown as a unit may or may not be a physical unit, that is, it may be located in one place, or may also be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the functions are realized in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
  • An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the program is used to implement at least one of the solutions described in the foregoing embodiments.
  • the computer storage medium in the embodiments of the present application may use any combination of one or more computer-readable media.
  • the computer readable medium may be a computer readable signal medium or a computer readable storage medium.
  • a computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples (non-exhaustive list) of computer readable storage media include: electrical connections with one or more leads, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), Erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer readable signal medium may include a data signal in baseband or propagated as part of a carrier wave with computer readable program code embodied therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. .
  • Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
  • Computer program code for performing the operations of the present application may be written in one or more programming languages or combinations thereof, including object-oriented programming languages—such as Java, Smalltalk, C++, and conventional procedural Programming language - such as "C" or a similar programming language.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as via the Internet using an Internet service provider). connect).
  • LAN local area network
  • WAN wide area network
  • connect such as via the Internet using an Internet service provider

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本申请涉及报文生成领域,特别是在客户端上显示的报文生成方法及装置。该方法包括:基于客户端的请求报文生成第一报文,第一报文为包括多个节点的树状结构;获取所述多个节点中的第一节点对应的图片;用所述图片替代所述第一报文中的所述第一节点,而生成第二报文;向所述客户端发送所述第二报文。利用该方法和装置,降低客户端所请求报文的显示时间,提高客户端用户体验。

Description

一种报文生成方法及装置 技术领域
本申请涉及报文生成方法,特别是在客户端上显示的报文生成方法及装置。
背景技术
客户端应用程序在显示从服务器获取的报文内容文件和JavaScript文件(JavaScript,简称JS)时,客户端首先运行该JS文件,生成虚拟的文本对象模型(Document Object Model,简称DOM)接口;通过解析虚拟的DOM结构,并与本地缓存DOM接口对比,从而生成渲染指令,然后根据所述渲染指令把虚拟的DOM接口转换为显示组件,以显示所述报文。
上述方法中报文中元素的数量多少与嵌套结构将影响渲染时延,占用内存大,影响用户体验。
发明内容
有鉴于此,本申请提供了一种报文生成方法及装置,能够降低显示时间和内存占用,提高用户体验。
为达到上述目的,本申请的第一方面提供一种报文生成方法,包括:基于客户端的请求报文生成第一报文,第一报文为包括多个节点的树状结构;获取第一报文中多个节点中的第一节点对应的图片;用该图片替代第一报文中的第一节点,而生成第二报文;向客户端发送第二报文。
由上,用第一报文中第一节点对应的图片替代第一节点,生成第二报文,并发送至客户端。因为第二报文结构简单,客户显示时无需进行复杂的报文的DOM解析和显示组件生成,降低了客户端在显示复杂报文时的资源消耗,提高了客户端的用户体验。
在本申请第一方面的一种可能实施方式中,在获取第一报文中的第一节点对应的图片时,具体包括:获取第一节点构成的第一节点组合的复杂度;在该复杂度大于第一阈值时,获取第一节点组合对应的图片。在用图片替代第一报文中的第一节点而生成第二报文时,具体包括:将第一报文中的第一节点组合用对应的图片替代,而生成第二报文。
由上,当第一节点组合的复杂度大于设定阈值时,用第一节点组合对应的图片替代第一报文中的第一节点组合,使报文结构更加简单,同时从而避免使用图片替代简单的第一节点组合,进一步减少了客户端在显示时的资源消耗,提高了客户端的体验。
在本申请第一方面的一种可能实施方式中,第一节点是内容固定的静态节点。
由上,限定第一节点为内容固定的静态节点,使服务器只获取静态节点或其组合对应的图片,降低服务器资源。
在本申请第一方面的一种可能实施方式中,在用对应的图片替代第一报文中的第一节点而生成第二报文时,具体包括:获取客户端的种类信息;根据该种类信息确定客户端的种类对应的用户数目;当用户数目大于第二阈值时,用对应的图片替代第一报文中的第一节点,而生成第二报文。
由上,统计第一节点组合的各客户端种类的用户群数目,当一客户端种类的用户群数目超过设定阈值时,使用第一节点组合对应的图片代替该第一节点组合,减少了该用户群在显示第一节点组合时的资源消耗,提高了客户端的体验;同时设置了用户群数目的门限,是服务器及时清除服务器中未达用户数目的图片,降低对服务器的资源消耗。
在本申请第一方面的一种可能实施方式中,客户端的种类信息包括客户端型号、客户端操作系统版本或客户端版本中的一项或多项。
由上,确定客户端的种类,从而在获取第一节点或第一节点组合对应图片时,根据客户端的种类获取对应的图片,使对应的图片与客户端匹配。
在本申请第一方面的一种可能实施方式中,第一阈值通过如下方式确定:获取多个第一报文;计算多个第一报文中的第一节点组合的资源消耗量的差值和复杂度,其中,该差值为基于第一报文显示第一节点组合占用的资源消耗量与显示第一节点组合对应的图片占用的资源消耗量的差值;基于多个第一节点组合的复杂度和该差值,确定第一阈值。
由上,通过多个第一节点组合的复杂度和资源消耗量的差值确定的节点复杂度的第一阈值,从而在选择复杂度高的节点组合使用对应图片进行替换时,提供准确的判断标准。
在本申请第一方面的一种可能实施方式中,资源消耗量由显示节点组合的占用内存和显示时间中的一项或多项确定。
由上,综合计算显示节点组合的占用内存和显示时间确定资源消耗量,更加准确预估资源消耗量,为确定第一阈值提供准确的数据依据。
在本申请第一方面的一种可能实施方式中,基于节点组合的节点层数、节点个数、节点复杂权重和所占像素面积中的一项或多项确定节点组合的复杂度。
由上,基于节点层数、节点个数、节点类型和所占像素面积综合确定第一节点组合的复杂度,从而为准确判断需要替换为图片的第一节点组合提供依据。
在本申请第一方面的一种可能实施方式中,节点复杂权重由节点组合中节点类型确定。
由上,基于节点类型确定节点复杂权重,从而更加准确计算节点复杂度。
为达到上述目的,本申请的第二方面提供一种报文生成装置,包括:第一报文生成模块,用于基于客户端的请求报文生成第一报文,第一报文为包括多个节点的树状结构;图片获取模块,用于获取第一报文的多个节点中的第一节点对应的图片;报文替换模块,用于对应的图片替代第一报文中的第一节点,而生成第二报文;报文发送模块,用于向客户端发送第二报文。
由上,用第一报文中第一节点对应的图片替代第一节点,生成第二报文,并发送 至客户端。因为第二报文结构简单,客户显示时无需进行复杂的报文的DOM解析和显示组件生成,降低了客户端在显示复杂报文时的资源消耗,提高了客户端的用户体验。
在本申请第二方面的一种可能实施方式中,图片获取模块具体用于获取第一节点构成的第一节点组合的复杂度;以及还具体用于在复杂度大于第一阈值时,获取第一节点组合对应的图片;报文替换模块具体用于将第一报文中的第一节点组合用图片替代,而生成第二报文。
由上,当第一节点组合的复杂度大于设定阈值时,用第一节点组合对应的图片替代第一报文中的第一节点组合,使报文结构更加简单,同时从而避免使用图片替代简单的第一节点组合,进一步减少了客户端在显示时的资源消耗,提高了客户端的体验。
在本申请第二方面的一种可能实施方式中,第一节点是内容固定的静态节点。
由上,限定第一节点为内容固定的静态节点,使服务器只获取静态节点或其组合对应的图片,降低服务器资源。
在本申请第二方面的一种可能实施方式中,报文替换模块具体用于获取客户端的种类信息;以及还具体用于根据客户端的种类信息确定客户端的种类对应的用户数目;以及还具体用于当用户数目大于第二阈值时,用对应的图片替代第一报文中的第一节点,而生成第二报文。
由上,统计第一节点组合的各客户端种类的用户群数目,当一客户端种类的用户群数目超过设定阈值时,使用第一节点组合对应的图片代替该第一节点组合,减少了该用户群在显示第一节点组合时的资源消耗,提高了客户端的体验;同时设置了用户群数目的门限,是服务器及时清除服务器中未达用户数目的图片,降低对服务器的资源消耗。
在本申请第二方面的一种可能实施方式中,客户端的种类信息包括客户端型号、客户端操作系统版本或客户端版本中的一项或多项。
由上,确定客户端的种类,从而在获取第一节点或第一节点组合对应图片时,根据客户端的种类获取对应的图片,使对应的图片与客户端匹配。
在本申请第二方面的一种可能实施方式中,还包括第一阈值生成装置,用于获取多个第一报文;以及还用于计算多个第一报文中的第一节点组合的资源消耗量的差值和复杂度,其中,该差值为基于第一报文显示第一节点组合占用的资源消耗量与显示对应的图片占用的资源消耗量的差值;以及还用于基于多个第一节点组合的复杂度和资源消耗量的差值,确定第一阈值。
由上,通过多个第一节点组合的复杂度和资源消耗量的差值确定的节点复杂度的第一阈值,从而在选择复杂度高的节点组合使用对应图片进行替换时,提供准确的判断标准。
在本申请第二方面的一种可能实施方式中,资源消耗量由显示节点组合的占用内存和显示时间中的一项或多项确定。
由上,综合计算显示节点组合的占用内存和显示时间确定资源消耗量,更加准确预估资源消耗量,为确定第一阈值提供准确的数据依据。
在本申请第二方面的一种可能实施方式中,基于节点组合的节点层数、节点个数、 节点复杂权重和所占像素面积中的一项或多项确定复杂度。
由上,基于节点层数、节点个数、节点类型和所占像素面积综合确定第一节点组合的复杂度,从而为准确判断需要替换为图片的第一节点组合提供依据。
在本申请第二方面的一种可能实施方式中,节点复杂权重由节点组合中节点类型确定。
由上,基于节点类型确定节点复杂权重,从而更加准确计算节点复杂度。
为达到上述目的,本申请的第三方面提供了一种计算设备,包括处理器与存储器,存储器存储有程序指令,该程序指令当被处理器执行时使得处理器执行本申请第一方面的报文生成方法。
为达到上述目的,本申请的第四方面提供了一种存储介质,其上存储有程序指令,程序指令当被计算机执行时使得计算机执行本申请第一方面的报文生成方法。
为达到上述目的,本申请的第五方面提供了一种计算机程序产品,其包括有程序指令,该程序指令当被计算机执行时使得计算机执行本申请第一方面的报文生成方法。
附图说明
图1A为本申请各实施例应用系统的结构示意图;
图1B为本申请实施例手机负一屏的卡片显示内容的示意图;
图2A为本申请方法实施例一的流程示意图;
图2B为一种天气查阅服务的第一报文的结构示意图;
图3A为本申请方法实施例二的流程示意图;
图3B为本申请方法实施例二的的图片获取方法的流程示意图;
图4为本申请方法实施例二的第一阈值确定方法实施例的流程示意图;
图5A为本申请方法实施例三的流程示意图;
图5B为本申请方法实施例三的图片替换方法的流程示意图;
图6为本申请装置实施一的结构示意图;
图7为本申请装置实施二的结构示意图;
图8为本申请装置实施二的的第一阈值确定模块的结构图;
图9为本申请装置实施三的结构示意图;
图10A为本申请一种具体实施方式的流程示意图;
图10B为本申请具体实施方式中第一报文的3种第一节点组合的示意图;
图10C为本申请具体实施方式中联合键值与图片的对应关系示意图;
图10D为本申请具体实施方式中第一报文内容的示意图;
图10E为本申请具体实施方式中第二报文内容的示意图;
图10F为本申请具体实施方式中第二报文的显示内容示意图;
图11为本申请计算设备实施例的结构示意图。
具体实施方式
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本申请实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。
说明书和权利要求书中的词语“第一、第二、第三等”或模块A、模块B、模块C等类似用语,仅用于区别类似的对象,不代表针对对象的特定排序,可以理解地,在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。
在以下的描述中,所涉及的表示步骤的标号,如S110、S120……等,并不表示一定会按此步骤执行,在允许的情况下可以互换前后步骤的顺序,或同时执行。
说明书和权利要求书中使用的术语“包括”不应解释为限制于其后列出的内容;它不排除其它的元件或步骤。因此,其应当诠释为指定所提到的所述特征、整体、步骤或部件的存在,但并不排除存在或添加一个或更多其它特征、整体、步骤或部件及其组群。因此,表述“包括装置A和B的设备”不应局限为仅由部件A和B组成的设备。
本说明书中提到的“一个实施例”或“实施例”意味着与该实施例结合描述的特定特征、结构或特性包括在本申请的至少一个实施例中。因此,在本说明书各处出现的用语“在一个实施例中”或“在实施例中”并不一定都指同一实施例,但可以指同一实施例。此外,在一个或多个实施例中,能够以任何适当的方式组合各特定特征、结构或特性,如从本公开对本领域的普通技术人员显而易见的那样。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。如有不一致,以本说明书中所说明的含义或者根据本说明书中记载的内容得出的含义为准。另外,本文中所使用的术语只是为了描述本申请实施例的目的,不是旨在限制本申请。
下面,首先对背景技术进行分析,其存在以下缺点:
1、背景技术中所述方案中需要采用DOM解析和显示组件生成的步骤,所以报文中元素的数量多少与嵌套结构将影响渲染时延;
2、在DOM解析和显示组件生成的步骤中报文的运行文件、临时变量和其他基础消耗等影响内存占用,内存占用大小与报文结构的复杂程度正相关。
本申请实施例提出了一种报文生成方法及装置,通过对报文进行分割,使用图片替代分割后的若干内容,降低显示时间和内存占用,提高用户体验。
下面基于图1A至图5B介绍本申请各方法实施例的方法和有益技术效果。
图1A示出了本申请实施例所应用的一种应用系统,包括服务器1、客户端3和网络2。客户端3可以是手机、平板电脑等移动终端,也可以是个人电脑等计算机,用来显示报文内容,显示方式至少包括网页、应用程序、手机负一屏的卡片,图1B示出了手机负一屏的卡片显示方式。服务器1用来基于客户端的报文请求生成报文,可以是云端服务器,也可以是本地服务器,可以是实体服务器,也可以是虚拟服务器。网络2用来在服务器1与客户端3之间传输报文,网络2可以是有线网络或无线网络或二者的混合。
【方法实施例一】
本实施例提供一种报文生成方法,该报文生成方法可以由服务器1执行。
方法实施例一基于客户端的报文请求生成第一报文,用第一报文中静态节点对应的图片替代静态节点,减少了客户端3在显示时的资源消耗,提高了客户端3的体验。
图2A示出了方法实施例的流程,其包括以下步骤:
S210.基于客户端3的请求报文生成第一报文,第一报文为包括多个节点的树状结构。
其中,客户端3所请求的报文用于在客户端3上显示。在一些实施例中,客户端3基于一个服务向服务器1请求报文,所请求的报文对应服务内容。
图2B示出了一种天气查阅服务的第一报文的示例,左边为客户端显示的查阅的天气内容,右边为对应的第一报文的树状结构。其中,第一报文的第一层有2个节点,分别是当天节点(图2B中为maininfor)和天气预测节点(图2B中为weatherforecast)节点,分别对应查阅当天的天气和从查阅当天的前一天开始的连续5天的天气,其中,当天节点又包括时间节点(图2B中为realtime)和当天天气节点(图2B中为allday),分别对应当天查阅时的具体时间和当天的天气;天气预测节点包括5个天节点(图2B中标记为0、1、2,其中,3和4未标出),分别对应从查询当天的前一天开始的连续5天的天气情况,每个天节点包括4个节点,分别为日期、星期、天气和温度节点(在图2B中分别为Date、Week、url和Temperature),其中天气节点是图片形式。
S220.获取第一报文的多个节点中的第一节点对应的图片,第一节点是内容固定的静态节点。
其中,在一些实施例中,如果第一报文的树状结构中一节点中包含的节点都是静态节点,则该节点也是第一节点。
继续以图2B为例,当天节点对应当天查阅时的具体时间和当天的天气,因为具体时间一直在变化,所以时间节点不是第一节点,包含时间节点的当天节点也不是第一节点。在查询的当天,天气预测节点中每个天节点对应的日期、星期、天气和温度都是不变的,所以每个天节点包括的4个节点都是第一节点,每个天节点也是第一节点,天气预测节点是第一节点。
其中,第一节点对应的图片包括第一节点对应的所有显示内容,在一些实施例中,当第一节点对应的图片不存在时,则创建该图片。
其中,在一些实施例中,还基于客户终端的类型选择适配的图片,以满足不同终端的需求。
由上,因为静态节点的内容不变,所以在客户端3对应的显示内容也是不变的,从而可以使用图片替代静态节点,使报文结构简单。
S230.用第一节点对应的图片替代第一节点,而生成第二报文。
具体地,将第一报文中第一节点对应的报文用第一节点对应的图片的网络地址(Uniform Resource Locator,URL)替代。在客户端3显示第二报文时,基于该URL直接获取第一节点对应的图片。
由上,使用图片替代静态节点,使报文结构简单,客户显示时无需进行复杂的报文的DOM解析和显示组件生成。
S240.向客户端3发送第二报文。
由上,在第二报文中静态节点已被图片替换,第二报文结构简单,客户端3显示时无需进行报文的DOM解析和显示组件生成。
综上,方法实施例一基于客户端3的报文请求生成第一报文,用第一报文中静态节点对应的图片替代静态节点,生成第二报文,并发送至客户端3。因为第二报文结构简单,客户端3显示时无需进行复杂的报文的DOM解析和显示组件生成,降低了客户端3在显示复杂报文时的资源消耗,提高了客户端3的体验。
【方法实施例二】
本实施例提供一种报文生成方法,该报文生成方法可以由服务器1执行。
方法实施例二在方法实施例一的基础上,对静态节点进行组合,当第一报文中若干个静态节点组成的节点组合的复杂度大于设定阈值时,使用该静态节点组合对应的图片代替该静态节点组合,进一步减少了客户端3在显示时的资源消耗,提高了客户端3的体验。
图3A示出了方法实施例二的流程,相对于方法实施例一的流程,其用步骤S222和S232分别代替了方法实施例一中步骤220和S230,下面重点介绍变化的步骤:
S222.获取第一报文的多个节点中的第一节点组合对应的图片。
其中,在一些实施例中,依次相邻的若干个静态节点都直接属于同一个节点,则该若干个的静态节点组成第一节点组合。
继续以图2B为例,天气预测节点中每个天节点是第一节点,且都直接属于天气预测节点,其中,任意几个依次相邻的天节点组成第一节点组合。
其中,第一节点组合为多个在一些实施例中,当第一节点组合的复杂度大于设定阈值时,获取其对应的图片。
具体地,本步骤的详细描述请参照【方法实施例二的图片获取方法】。
由上,获取第一节点组合对应的图片,在后续步骤替代第一报文中的第一节点组合,使报文结构更加简单。同时因为客户端3用显示对应的图片的方式来显示简单的第一节点组合时,所消耗的资源大不会降低,当复杂度大于设定阈值时才获取第一节点组合对应的图片,从而避免使用图片替代简单的第一节点组合。
S232.将第一报文中的第一节点组合用其对应图片替代,而生成第二报文。
由上,用复杂度大于设定阈值的第一节点组合对应的图片替换该第一节点组合,进一步减少了客户端3在显示时的资源消耗,提高了客户端3的体验。
【方法实施例二的图片获取方法】
方法实施例二的图片获取方法获取第一节点组合的复杂度,当第一节点组合的复杂度大于设定阈值时获取对应的图片,从而避免使用图片替代简单的第一节点组合。
图3B示出了方法实施例二的的图片获取方法的流程,其包括以下步骤:
S2210.获取第一节点构成的第一节点组合和其复杂度。
其中,在一些实施例中,至少基于第一节点组合的节点层数、节点个数、节点复杂权重和所占像素面积确定该节点组合的复杂度,节点层数越多或节点个数越多或所占像素面积减小时或节点复杂权重大时,复杂度越大。
其中,在一些实施例中,基于第一节点组合中节点类型确定节点的节点复杂权重,图片节点越多,节点复杂权重越大。·
具体地,第一节点组合的复杂度计算方法参照【第一阈值确定方法实施例】
由上,基于节点层数、节点个数、节点类型和所占像素面积综合确定第一节点组合的复杂度,从而为准确判断需要替换为图片的第一节点组合提供依据。
S2220.在第一节点组合的复杂度大于第一阈值时,获取该第一节点组合对应的图片。
其中,第一节点组合对应的图片包括第一节点对应的所有显示内容,在一些实施例中,当第一节点组合对应的图片不存在时,则创建该图片。
其中,在一些实施例中,还基于客户终端的类型选择适配的图片,以满足不同终端的需求。
由上,当复杂度大于设定阈值时才获取第一节点组合对应的图片,从而避免使用图片替代简单的第一节点组合。
【第一阈值确定方法实施例】
在介绍本实施例以前,先介绍其中关于节点组合的复杂度和资源消耗量的计算公式。
在本实施例中,资源消耗量由服务器1预估的显示节点组合的占用内存和显示时间中的一项或多项确定。其中,一种示例的资源消耗量计算公式如下所示:
Figure PCTCN2022094662-appb-000001
其中,cost为客户端3显示的待显示报文的资源消耗量;m i为客户端3显示待显示报文的占用内存,m basic为客户端3显示任一待显示报文时占用的基础内存,与客户端3的显示环境相关,与待显示报文无关,m max为客户端3显示任一待显示报文时可占用的最大内存;t i为客户端3显示待显示报文的占用时间,t basic为客户端3显示任一待显示报文时占用的基础时间,与客户端3的显示环境相关,与待显示报文无关,t max为客户端3显示任一待显示报文时可占用的最大时间。待显示报文为节点组合对应的报文,可以是节点组合在第一报文中对应的报文,也可以是节点组合对应的图片报文。
图4示出了第一阈值确定方法实施例的流程,其包括以下步骤:
S410.获取多个第一报文。
由上,获取多个第一报文,便于获得多种节点组合的资源消耗量与复杂度的样本,从而准确分析节点组合的资源消耗量与复杂度之间的关系。第一节点组合是节点组合的一种,是静态节点的组合。
S420.计算多个第一报文中的节点组合的资源消耗量的差值和复杂度,其中,资源消耗量的差值为基于第一报文显示节点组合占用的资源消耗量与显示对应的图片占用的资源消耗量的差值。
其中,在一些实施例中,基于节点组合的节点层数、节点个数、节点复杂权重和所占像素面积中的一项或多项确定节点组合的复杂度,节点复杂权重由节点组合中节点类型确定。一种示例的复杂度计算公式如下所示:
Figure PCTCN2022094662-appb-000002
其中,f为节点组合的复杂度,h为节点组合的节点层数,n为节点组合中静态节点的个数,η为节点组合的节点复杂权重,基于节点组合中的图像节点的比例确定,s为节点组合的像素面积,k为设置的常数。
其中,在一些实施例中,资源消耗量由服务器1预估的显示节点组合的占用内存和显示时间中的一项或多项确定。一种示例的资源消耗量计算公式如下所示:
Figure PCTCN2022094662-appb-000003
其中,cost为客户端3显示的待显示报文的资源消耗量;m i为客户端3显示待显示报文的占用内存,m basic为客户端3显示任一待显示报文时占用的基础内存,与客户端3的显示环境相关,与待显示报文无关,m max为客户端3显示任一待显示报文时可占用的最大内存;t i为客户端3显示待显示报文的占用时间,t basic为客户端3显示任一待显示报文时占用的基础时间,与客户端3的显示环境相关,与待显示报文无关,t max为客户端3显示任一待显示报文时可占用的最大时间。待显示报文为节点组合对应的报文,可以是节点组合在第一报文中对应的报文,也可以是节点组合对应的图片报文。
由上,计算节点组合的复杂度,以及计算基于第一报文显示节点组合占用的资源消耗量与显示对应的图片占用的资源消耗量的差值,为确定节点复杂度的第一阈值提供准确的数据依据。
S430.基于各节点组合的复杂度和资源消耗量的差值,确定第一阈值。
其中,在一些实施例中通过拟合多个节点组合的资源消耗量的差值与复杂度之间的关系,确定第一阈值。当节点组合的复杂度大于第一阈值时,资源消耗量的差值大于0,即基于第一报文显示节点组合占用的资源消耗量大于显示对应的图片占用的资源消耗量。
由上,通过多个节点组合的复杂度和资源消耗量的差值确定的节点复杂度的第一阈值,从而在选择复杂度高的节点组合使用对应图片进行替换时,提供准确的判断标准。
综上,方法实施例二在方法实施例一的基础上,当第一节点组合的复杂度大于设定阈值时,用第一节点组合对应的图片替代第一报文中的第一节点组合,使报文结构 更加简单,同时从而避免使用图片替代简单的第一节点组合,进一步减少了客户端3在显示时的资源消耗,提高了客户端3的体验。
【方法实施例三】
本实施例提供一种报文生成方法,该报文生成方法可以由服务器1执行。
方法实施例三在方法实施例二的基础上,当第一节点组合的用户数超过设定阈值时,使用第一节点组合对应的图片代替该第一节点组合时,减少了用户群在显示第一节点组合时的资源消耗,提高了客户端3的体验,同时降低对服务器1的资源消耗。
图5A示出了方法实施例三的流程,相对于方法实施例二的流程,其用S234代替了方法实施例二中步骤232,下面重点介绍该步骤:
S234.基于第一报文中的第一节点组合的用户数,把第一节点组合用其对应图片替代,而生成第二报文。
其中,在一些实施例中,基于第一节点组合的客户端3的种类信息统计各客户端3的种类对应的用户数目,当用户数目超过设定得第二阈值时,用第一节点组合对应的图片替代第一报文中的第一节点组合。
其中,在一些实施例中,对第一节点组合在服务器里保存的对应的图片基于最近最少使用策略(Least Recently Used,LRU)进行清理。
由上,当用户数目超过设定得第二阈值时,用第一节点组合对应的图片替代第一报文中的第一节点组合,同时对服务器里保存的对应的图片基于LRU策略(Least进行清理,特别是清理用户数目未满足第二阈值的第一节点组合对应的图片,从而在提升用户数目对应的用户群的体验同时,避免服务器资源被占用太多。
具体地,本步骤的详细描述请参照【方法实施例三的图片替换方法】。
【方法实施例三的图片替换方法】
图5B示出了方法实施例三的图片替换方法的流程,其包括以下步骤:
S2310.获取第一节点组合的客户端3的种类信息。
其中,在一些实施例中,客户端3的种类信息包括客户端3型号、客户端3操作系统版本或客户端3版本中的一项或多项。
由上,基于详细的客户端3的种类信息确定客户端3的种类,从而为准确统计各客户端3的用户群提供依据。
S2320.根据客户端3的种类信息确定各客户端3的种类对应的用户数目。
由上,根据客户端3的种类信息,统计第一节点组合的用户数目,从而确定第一节点组合的各客户端3的用户群。
S2330.当任一客户端3的种类对应的用户数目大于第二阈值时,用第一节点组合对应的图片替代第一报文中的第一节点组合,而生成第二报文。
由上,当用户数目超过设定得第二阈值时,用第一节点组合对应的图片替代第一报文中的第一节点组合,同时对服务器里保存的对应的图片基于LRU策略进行清理,从而在提升用户数目对应的用户群的体验同时,避免服务器资源被占用太多。
综上,方法实施例三在方法实施例二的基础上,统计第一节点组合的各客户端3 种类的用户群数目,当一客户端3种类的用户群数目超过设定阈值时,使用第一节点组合对应的图片代替该第一节点组合时,减少了该用户群在显示第一节点组合时的资源消耗,提高了客户端3的体验,同时降低对服务器1的资源消耗。
下面基于图6至图9介绍本申请各装置实施例的方法和有益技术效果。
【装置实施例一】
图6示出了装置实施例一的结构示意图,其包括以下模块:
第一报文生成模块610,用于基于客户端3的请求报文生成第一报文,第一报文为包括多个节点的树状结构。其详细工作原理和有益技术效果请参照【方法实施例一】的步骤S210。
图片获取模块620,用于获取第一报文中多个节点中的第一节点对应的图片。其详细工作原理和有益技术效果请参照【方法实施例一】的步骤S220。
报文替换模块630,用于第一节点对应的图片替代第一报文中该第一节点,而生成第二报文。其详细工作原理和有益技术效果请参照【方法实施例一】的步骤S230。
报文发送模块640,用于向客户端3发送第二报文。其详细工作原理和有益技术效果请参照【方法实施例一】的步骤S240。
【装置实施例二】
图7示出了装置实施例二的结构示意图,相对于装置实施例一的结构,其用图片获取模块622和报文替换模块632分别代替了装置实施例一中图片获取模块620和报文替换模块630,下面重点介绍变化的模块:
图片获取模块622,用于获取第一报文的多个节点中的第一节点组合对应的图片,具体用于获取第一节点构成的第一节点组合和其复杂度,以及还具体用于在第一节点组合的复杂度大于第一阈值时,获取该第一节点组合对应的图片。其详细工作原理和有益技术效果请参照【方法实施例二】的步骤S222。
其中,第一节点组合的复杂度通过【第一阈值确定模块】确定。
报文替换模块632,用于将第一报文中的第一节点组合用其对应图片替代,而生成第二报文。其详细工作原理和有益技术效果请参照【方法实施例二】的步骤S232。
【复杂度阈值确定模块】
图8示出了第一阈值确定模块的结构,其包括以下模块:
获取模块810,用于获取多个第一报文。其详细工作原理和有益技术效果请参照【第一阈值确定方法实施例】的步骤S410。
计算模块820,用于计算多个第一报文中的第一节点组合的资源消耗量的差值和复杂度,其中,资源消耗量的差值为基于第一报文显示第一节点组合占用的资源消耗量与显示该第一节点组合对应的图片占用的资源消耗量的差值。其详细工作原理和有益技术效果请参照【第一阈值确定方法实施例】的步骤S420。
确定模块830,用于基于多个第一节点组合的复杂度和资源消耗量的差值,确定第一阈值。其详细工作原理和有益技术效果请参照【第一阈值确定方法实施例】的步 骤S430。
【装置实施例三】
图9示出了装置实施例三的结构示意图,相对于装置实施例二的结构,其用报文替换模块634代替了装置实施例二中报文替换模块632,下面重点该模块:
报文替换模块634,用于基于第一报文中的第一节点组合的用户数,把第一节点组合用其对应图片替代,而生成第二报文。其具体用于获取第一节点组合的客户端3的种类信息,以及还具体用于根据客户端3的种类信息确定各客户端3的种类对应的用户数目,以及还具体用于当任一客户端的种类对应的用户数目大于第二阈值时,用第一节点组合对应的图片替代第一报文中的第一节点组合,而生成第二报文。报文替换模块634的详细工作原理和有益技术效果请参照【方法实施例三】的步骤S234。
【具体实施方式】
下面基于图10A至图10F以手机的负一屏的服务卡片为示例,介绍本申请的具体实施方式。本申请的具体实施方式在服务器1执行。
图10A示出了本申请的报文生成方法具体实施方式的流程,其包括以下步骤。
S1010.基于客户端3的报文请求生成第一报文。
其中,本具体实施方式中客户端3的报文请求为手机负一屏的一服务卡片的报文请求。
S1020.从第一报文中获取各种第一节点组合,并计算各第一节点组合的复杂度,其中,第一节点为是内容固定的静态节点。
示例地,图10B示出的3种第一节点组合:
(a)整个第一报文为一个第一节点组合;
(b)从第一报文中分割出一个节点组合,包括节点2和节点3,节点2和节点3的下属节点都是第一节点,他们相邻且都直接属于同一个节点;
(c)从报文中分割出2个节点组合,其中一个第一节点组合由节点2.2和节点2.3组成,另一个节点组合为节点3。
其中,在本具体实施方式中,从第一报文的树干逐个树枝选择第一节点组合;当一个树枝上的节点均为静态节点时,则选择整个树枝的节点构成第一节点组合;以及如果在同一层次上存在依次相邻的第一节点组合,则对他们进行合并,生成大的第一节点组合,选择该新的第一节点组合;当一个树枝上的节点不都是静态节点时,则进入从该树枝进入下个层次,用上述同样方法对该树枝的下层子树枝进行同样的选择。采用这种从上而下的方法实现对第一报文实现最优化分割出各第一节点组合。
其中,获取各第一节点组合后,利用计算公式如式(1),根据各第一节点组合的节点层数、节点个数、节点复杂权重和所占像素面积确定各第一节点组合的复杂度。
S1030.从各第一节点组合中选择复杂度大于第一阈值的第一节点组合,并确定其联合键值。
其中,联合键值至少包括第一报文的标识、第一节点组合的标识和客户端设备的标识。第一报文的标识用于区分第一报文,示例地,基于同一种服务卡片的报文请求 生成第一报文,其具有相同的报文结构,对应于服务卡片的服务内容结构,第一报文的标识又称作服务ID;第一节点组合的标识对应于第一报文中第一节点组合的报文,该报文又称为响应报文,第一节点组合的标识又称为响应报文ID;设备的标识用来区分不同的客户端3设备种类,又称为设备ID。
其中,基于联合键值确定第一节点组合对应的图片,联合键值与对应的图片的URL构成键值对,存储在服务器1中。图10C示出了联合键值与图片的对应关系。示例地,图10C以手机的负一屏的天气服务卡片为例,其包括三个第一响应报文,第一个第一响应报文与三种终端设备对应,对应三种联合键值,对应三种图片。
S1040.基于联合键值判断在服务器1的中是否查询到其对应的图片。其中,当查询到对应的图片时,则运行步骤S1050,否则运行步骤S1070。
其中,当在服务器1中查询到图片时,则对用户数目进行判断;否则创建与联合键值对应的图片,并存储在服务器1中。
S1050.判断图片的用户数目是否大于第二阈值。其中,如果大于第二阈值,则运行步骤S1060,否则运行步骤S1080。
其中,用户数目为基于联合健值查询到图片的用户数,用户与客户端设备一一对应。当用户数目大于第二阈值时,用图片的URL代替其在第一报文中对应的响应报文,以提高后续客户端3用户体验。
其中,当生成大量图片时,会占用服务器1大量资源,为了降低服务器1的资源使用,服务器1基于LRU策略对过期的图片进行清理,设置合理的第二阈值,服务器1及时清理用户数目未达第二阈值的图片,在提升图片对应的用户群的体验同时,使服务器1的资源不会被太多占用。
S1060.用图片替代第一报文中的第一节点组合。
具体地,用图片的URL替换第一节点组合对应的响应报文。
其中,客户端3显示图片的URL相对于显示响应报文,占用的资源消耗量较小。
示例地,当响应报文在手机中显示时,则要经过解析虚拟的DOM结构和把虚拟的DOM接口转换为显示组件的详细流程,占用的资源消耗量较大;显示图片时,不运行上述过程,占用的资源消耗量较小。
S1070.创建第一节点组合对应的图片。
其中,所创建图片存于服务器1中,其URL与相应的联合健值组成健值对,用于后续其他客户端3查询。
S1080.用户数目加1。
其中,累积用户数目,用于与第二阈值对比。
S1090.判断是否有未被选择的第一节点组合。其中,还有未被选择的第一节点组合,则运行步骤S1030,否则运行步骤S1100。
其中,因为在步骤S1030实施了从上之下的第一节点组合的获取方法,所获取的第一节点组合不会交叉,是一种最优分割策略。
S1100.基于替换后的第一报文生成第二报文,下发至客户端3进行显示。
其中,显示第二报文相对于直接显示第一报文,占用的资源消耗量较小,客户端3用户体验好。
示例地,图10D示出了一第一报文示例,用于在手机卡片上显示体育比赛结果,其具有多个节点内容,结构复杂,显示流程复杂,占用资源消耗量大。
示例地,图10E示出了一第二报文示例,其对应的第一报文是一个第一节点组合,用对应图片的URL替换了第一节点组合后,整个第二报文为对应图片的URL,报文结构简单,显示流程简单,占用资源消耗量小。
示例地,图10F示出了第二报文在手机上显示的示例,用本申请具体实施方式的方法,对已经完成的比赛的结果使用相应的图片替代,如图中分别用方框围住的NBA全明星的比赛结果和英超的比赛结果,占用资源消耗量小,显示时间短,提高了客户端3用户体验。
【计算设备实施例】
图11是本申请实施例提供的一种计算设备1100的结构性示意性图。该计算设备1100包括:处理器1110、存储器1120、通信接口1130。
应理解,图11所示的计算设备1100中的通信接口1130可以用于与其他设备之间进行通信。
其中,该处理器1110可以与存储器1120连接。该存储器1120可以用于存储该程序代码和数据。因此,该存储器1120可以是处理器1110内部的存储模块,也可以是与处理器1110独立的外部存储模块,还可以是包括处理器1110内部的存储模块和与处理器1110独立的外部存储模块的部件。
应理解,在本申请实施例中,该处理器1110可以采用中央处理模块(central processing unit,CPU)。该处理器还可以是其它通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field programmable gate Array,FPGA)或者其它可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。或者该处理器1110采用一个或多个集成电路,用于执行相关程序,以实现本申请实施例所提供的技术方案。
该存储器1120可以包括只读存储器和随机存取存储器,并向处理器1110提供指令和数据。处理器1110的一部分还可以包括非易失性随机存取存储器。例如,处理器1110还可以存储设备类型的信息。
在计算设备1100运行时,处理器1110执行存储器1120中的计算机执行指令执行上述方法的操作步骤。
应理解,根据本申请实施例的计算设备1100可以对应于执行根据本申请各实施例的方法中的相应主体,并且计算设备1100中的各个模块的上述和其它操作和/或功能分别为了实现本实施例各方法的相应流程,为了简洁,在此不再赘述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
【计算机可读存储介质实施例】
本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时用于执行上述各个实施例所描述的方案中的至少之一。
本申请实施例的计算机存储介质,可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是,但不限于,电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。
计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中连接了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播 或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。
计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括、但不限于无线、电线、光缆、RF等等,或者上述的任意合适的组合。
可以以一种或多种程序设计语言或其组合来编写用于执行本申请操作的计算机程序代码,程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络,包括局域网(LAN)或广域网(WAN),连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
注意,上述仅为本申请的较佳实施例及所运用的技术原理。本领域技术人员会理解,本申请不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本申请的保护范围。因此,虽然通过以上实施例对本申请进行了较为详细的说明,但是本申请不仅仅限于以上实施例,在不脱离本申请的构思的情况下,还可以包括更多其他等效实施例,均属于本申请的保护范畴。

Claims (21)

  1. 一种报文生成方法,其特征在于,包括:
    基于客户端的请求报文生成第一报文,第一报文为包括多个节点的树状结构;
    获取所述多个节点中的第一节点对应的图片;
    用所述图片替代所述第一报文中的所述第一节点,而生成第二报文;
    向所述客户端发送所述第二报文。
  2. 根据权利要求1所述的报文生成方法,其特征在于,
    所述获取所述多个节点中的第一节点对应的图片,具体包括:
    获取所述第一节点构成的第一节点组合的复杂度;
    在所述复杂度大于第一阈值时,获取所述第一节点组合对应的所述图片;
    所述用所述图片替代所述第一报文中的所述第一节点,而生成第二报文,具体包括:
    将所述第一报文中的所述第一节点组合用所述图片替代,而生成所述第二报文。
  3. 根据权利要求1或2所述的报文生成方法,其特征在于,所述第一节点是内容固定的静态节点。
  4. 根据权利要求1所述的报文生成方法,其特征在于,所述用所述图片替代所述第一报文中的所述第一节点,而生成第二报文,具体包括:
    获取所述客户端的种类信息;
    根据所述种类信息确定所述客户端的种类对应的用户数目;
    当所述用户数目大于第二阈值时,用所述图片替代所述第一报文中的所述第一节点,而生成所述第二报文。
  5. 根据权利要求4所述的报文生成方法,其特征在于,所述客户端的种类信息包括客户端型号、客户端操作系统版本或客户端版本中的一项或多项。
  6. 根据权利要求2所述的报文生成方法,其特征在于,所述第一阈值通过如下方式确定:
    获取多个所述第一报文;
    计算所述多个所述第一报文中的所述第一节点组合的资源消耗量的差值和复杂度,其中,所述差值为基于第一报文显示所述第一节点组合占用的资源消耗量与显示所述第一节点组合对应的所述图片占用的资源消耗量的差值;
    基于所述多个第一节点组合的所述复杂度和所述差值,确定所述第一阈值。
  7. 根据权利要求6所述的报文生成方法,其特征在于,所述资源消耗量由显示所 述节点组合的占用内存和显示时间中的一项或多项确定。
  8. 根据权利要求2所述的报文生成方法,其特征在于,还包括:
    基于所述节点组合的节点层数、节点个数、节点复杂权重和所占像素面积中的一项或多项确定所述复杂度。
  9. 根据权利要求5所述的报文生成方法,其特征在于,所述节点复杂权重由所述节点组合中节点类型确定。
  10. 一种报文生成装置,其特征在于,包括:
    第一报文生成模块,用于基于客户端的请求报文生成第一报文,第一报文为包括多个节点的树状结构;
    图片获取模块,用于获取所述多个节点中的第一节点对应的图片;
    报文替换模块,用于所述图片替代所述第一报文中的所述第一节点,而生成第二报文;
    报文发送模块,用于向所述客户端发送所述第二报文。
  11. 根据权利要求10所述的报文生成装置,其特征在于,
    所述图片获取模块具体用于获取所述第一节点构成的第一节点组合的复杂度;以及
    还具体用于在所述复杂度大于第一阈值时,获取所述第一节点组合对应的所述图片;
    所述报文替换模块具体用于将所述第一报文中的所述第一节点组合用所述图片替代,而生成所述第二报文。
  12. 根据权利要求10或11所述的报文生成装置,其特征在于,所述第一节点是内容固定的静态节点。
  13. 根据权利要求10所述的报文生成装置,其特征在于,
    所述报文替换模块具体用于获取所述客户端的种类信息;以及
    还具体用于根据所述种类信息确定所述客户端的种类对应的用户数目;以及
    还具体用于当所述用户数目大于第二阈值时,用所述图片替代所述第一报文中的所述第一节点,而生成所述第二报文。
  14. 根据权利要求13所述的报文生成装置,其特征在于,所述客户端的种类信息包括客户端型号、客户端操作系统版本或客户端版本中的一项或多项。
  15. 根据权利要求11所述的报文生成装置,其特征在于,还包括:
    第一阈值生成装置,用于获取多个所述第一报文;以及
    还用于计算所述多个所述第一报文中的所述第一节点组合的资源消耗量的差值和复杂度,其中,所述差值为基于第一报文显示所述第一节点组合占用的资源消耗量与显示所述第一节点组合对应的所述图片占用的资源消耗量的差值;以及
    还用于基于所述多个第一节点组合的所述复杂度和所述差值,确定所述第一阈值。
  16. 根据权利要求15所述的报文生成装置,其特征在于,所述资源消耗量由显示所述节点组合的占用内存和显示时间中的一项或多项确定。
  17. 根据权利要求11所述的报文生成装置,其特征在于,还包括:
    基于所述节点组合的节点层数、节点个数、节点复杂权重和所占像素面积中的一项或多项确定所述复杂度。
  18. 根据权利要求14所述的报文生成装置,其特征在于,所述节点复杂权重由所述节点组合中节点类型确定。
  19. 一种计算设备,其特征在于,包括处理器与存储器,
    所述存储器存储有程序指令,所述程序指令当被所述处理器执行时使得所述处理器执行权利要求1至9任意一项所述的方法。
  20. 一种存储介质,其特征在于,其上存储有程序指令,所述程序指令当被计算机执行时使得所述计算机执行权利要求1至9任意一项所述的方法。
  21. 一种计算机程序产品,其特征在于,其包括有程序指令,所述程序指令当被计算机执行时使得所述计算机执行权利要求1至9任意一项所述的方法。
PCT/CN2022/094662 2021-06-21 2022-05-24 一种报文生成方法及装置 WO2022267797A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110687396.1 2021-06-21
CN202110687396.1A CN115509675A (zh) 2021-06-21 2021-06-21 一种报文生成方法及装置

Publications (1)

Publication Number Publication Date
WO2022267797A1 true WO2022267797A1 (zh) 2022-12-29

Family

ID=84500395

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/094662 WO2022267797A1 (zh) 2021-06-21 2022-05-24 一种报文生成方法及装置

Country Status (2)

Country Link
CN (1) CN115509675A (zh)
WO (1) WO2022267797A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105516261A (zh) * 2015-11-26 2016-04-20 深圳市深信服电子科技有限公司 网页页面加载控制方法及负载均衡器
CN108848141A (zh) * 2018-05-31 2018-11-20 郑州云海信息技术有限公司 一种服务器数据访问的响应方法以及相关方法和相关装置
US20200068656A1 (en) * 2016-11-28 2020-02-27 Lg Electronics Inc. Method and apparatus for transmitting and receiving data in mesh network using bluetooth
CN112104697A (zh) * 2018-05-31 2020-12-18 华为技术有限公司 一种数据处理的方法、多云管理系统以及相关设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105516261A (zh) * 2015-11-26 2016-04-20 深圳市深信服电子科技有限公司 网页页面加载控制方法及负载均衡器
US20200068656A1 (en) * 2016-11-28 2020-02-27 Lg Electronics Inc. Method and apparatus for transmitting and receiving data in mesh network using bluetooth
CN108848141A (zh) * 2018-05-31 2018-11-20 郑州云海信息技术有限公司 一种服务器数据访问的响应方法以及相关方法和相关装置
CN112104697A (zh) * 2018-05-31 2020-12-18 华为技术有限公司 一种数据处理的方法、多云管理系统以及相关设备

Also Published As

Publication number Publication date
CN115509675A (zh) 2022-12-23

Similar Documents

Publication Publication Date Title
US10546322B2 (en) Advertisements for applications on an online social network
US10122788B2 (en) Managed function execution for processing data streams in real time
KR101719238B1 (ko) 포워드 인덱스를 사용하여 검색하기 위한 방법, 컴퓨터-판독가능한 비-일시적 저장매체 및 시스템
US9268716B2 (en) Writing data from hadoop to off grid storage
US20100268694A1 (en) System and method for sharing web applications
US10740415B2 (en) Content recommendation
US8819139B2 (en) Virtual desktop infrastructure (VDI) login acceleration
US8996462B2 (en) System and method for managing duplicate file uploads
WO2022033241A1 (zh) 对象的处理方法及装置、存储介质和电子设备
US20190005534A1 (en) Providing media assets to subscribers of a messaging system
US20180248772A1 (en) Managing intelligent microservices in a data streaming ecosystem
CN111352903A (zh) 日志管理平台、日志管理方法、介质以及电子设备
WO2018156979A1 (en) Selective distribution of messages in a publish-subscribe system
US8874687B2 (en) System and method for dynamically modifying content based on user expectations
CN116546080A (zh) 增强的在线隐私
WO2014086195A1 (zh) 视频处理方法、移动终端及服务器
US11706313B2 (en) Systems, methods, and devices for user interface customization based on content data network priming
WO2022104269A1 (en) Geospatial data analytics and visualization platform
WO2022267797A1 (zh) 一种报文生成方法及装置
US11494408B2 (en) Asynchronous row to object enrichment of database change streams
CN117149777A (zh) 一种数据查询方法、装置、设备及存储介质
US10601749B1 (en) Trends in a messaging platform
WO2023273922A1 (zh) 一种账号管理方法、系统和计算机可读存储介质
CN110442616B (zh) 一种针对大数据量的页面访问路径分析方法与系统
US20170177337A1 (en) Weighted pseudo - random digital content selection

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22827294

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE