Data transmission method and device

By performing multiple serialization and encapsulation operations on business data, combined with the encapsulation of transmission protocols, the problem of low data transmission efficiency in instant messaging services is solved, and efficient data transmission and resource saving are achieved.

CN118740959APending Publication Date: 2024-10-01JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410764097.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

In the existing technology, when data is transmitted in instant messaging services, the compressed data volume is still large, resulting in low transmission efficiency, long time consumption, and consumption of a large amount of system resources.

Method used

Use preset nested data structures to perform multiple serialization operations on business data, and encapsulate structured data according to the transmission protocol to ensure that the data complies with the transmission protocol and is transmitted to the recipient.

Benefits of technology

It improves data transmission efficiency, shortens transmission time, saves system resources, ensures data integrity and readability, and optimizes the data encapsulation and parsing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118740959A_ABST
    Figure CN118740959A_ABST
Patent Text Reader

Abstract

The invention discloses a data transmission method and device, and relates to the technical field of computers. A specific embodiment of the data transmission method comprises the following steps: packaging acquired service data according to a preset nested data structure, and executing multiple serialization operations on multiple layers of data in the packaged service data to obtain structured data; according to a preset transmission protocol, packaging the structured data to obtain transmission data conforming to the transmission protocol; and transmitting the transmission data to a receiver corresponding to the service data. According to the embodiment, the business data is converted into the transmission data with small data volume based on multiple serialization operations and packaging operations, so that the transmission efficiency of the transmission data can be improved, the data transmission time can be shortened, and system resources can be saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for data transmission. Background Art

[0002] In the field of instant messaging, multiple terminals establish message channels through basic networks and network communication protocols, and transmit data through the message channels. When transmitting communication data such as text and images, there are usually two methods. One method is to directly encapsulate the data to be transmitted into transmission data that conforms to the transmission protocol, and then transmit the transmission data. The other method is to perform one or more compression operations on the data to be transmitted, and then encapsulate the compressed data into transmission data, and then transmit the transmission data.

[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:

[0004] The compressed data volume is still relatively large, resulting in low data transmission efficiency and long time consumption, and a large amount of system resources are consumed when transmitting data. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a method and apparatus for data transmission, which can improve the transmission efficiency of transmitted data, shorten the data transmission time, and save system resources.

[0006] To achieve the above object, according to a first aspect of an embodiment of the present invention, a method for data transmission is provided, including:

[0007] According to the preset nested data structure, the acquired business data is encapsulated, and multiple serialization operations are performed on the multi-layer data in the encapsulated business data to obtain structured data;

[0008] According to the preset transmission protocol, the structured data is encapsulated to obtain transmission data that complies with the transmission protocol;

[0009] The transmission data is transmitted to the recipient corresponding to the business data.

[0010] Optionally, the nested data structure includes: a business encapsulation structure and a message encapsulation structure, the business encapsulation structure defines fields included in the business encapsulation data and data types corresponding to the fields, and the message encapsulation structure defines fields included in the message encapsulation data and data types corresponding to the fields; according to the preset nested data structure, multiple serialization operations are performed on the business data to obtain structured data, including:

[0011] According to the business encapsulation structure, the business data is encapsulated to obtain business encapsulation data, and the business encapsulation data is serialized to obtain business sequence data;

[0012] According to the message encapsulation structure, the preset message basic data is obtained, the business sequence data and the message basic data are encapsulated to obtain the message encapsulation data, and the message encapsulation data is serialized to obtain structured data; the message basic data is data related to the business scenario associated with the business data.

[0013] Optionally, before serializing the service encapsulation data to obtain the service sequence data,

[0014] Determining the data length of the service encapsulation data;

[0015] It is determined that the data length of the service encapsulation data is greater than a preset first threshold.

[0016] Optionally, multiple serialization methods are pre-set; before serializing the business encapsulation data,

[0017] Identify the business scenarios associated with the business data;

[0018] According to the business scenario, a target serialization method is determined from a variety of serialization methods. The target serialization method is used to serialize business encapsulation data and message encapsulation data.

[0019] Optionally, according to a preset transmission protocol, the structured data is encapsulated to obtain transmission data that complies with the transmission protocol, including:

[0020] Get multiple encapsulation information of structured data;

[0021] According to the preset byte alignment rules, determine the arrangement order and byte length of multiple encapsulation information and structured data;

[0022] According to the arrangement order and byte length, multiple encapsulation information and structured data are encapsulated, and the encapsulated data is used as transmission data.

[0023] Optionally, before encapsulating the structured data, determining the data length of the structured data; in response to the data length of the structured data being greater than a preset second threshold, performing a data compression operation on the structured data to obtain compressed data;

[0024] The structured data is encapsulated according to a preset transmission protocol, including: according to the preset transmission protocol, the compressed data is encapsulated, and the encapsulated compressed data is used as transmission data.

[0025] According to a second aspect of an embodiment of the present invention, a method for data transmission is provided, including:

[0026] According to a preset transmission protocol, second structured data is parsed from the received return data; the return data is obtained by the following steps: encapsulating the acquired first business data according to a preset nested data structure, performing multiple serialization operations on the multi-layer data in the encapsulated first business data to obtain first structured data, and encapsulating the first structured data to obtain return data that complies with the transmission protocol;

[0027] According to the preset nested data structure, multiple deserialization operations are performed on the multi-layer data in the second structured data to obtain second business data;

[0028] The second service data is transmitted to a recipient corresponding to the returned data.

[0029] According to a third aspect of an embodiment of the present invention, a data transmission device is provided, including:

[0030] A serialization module is used to encapsulate the acquired business data according to a preset nested data structure, and perform multiple serialization operations on the multi-layer data in the encapsulated business data to obtain structured data;

[0031] The encapsulation module is used to encapsulate the structured data according to the preset transmission protocol to obtain transmission data that complies with the transmission protocol;

[0032] The transmission module is used to transmit the transmission data to the recipient corresponding to the business data.

[0033] Optionally, the nested data structure includes: a business encapsulation structure and a message encapsulation structure, the business encapsulation structure defines fields included in the business encapsulation data and data types corresponding to the fields, and the message encapsulation structure defines fields included in the message encapsulation data and data types corresponding to the fields; the serialization module is further used for:

[0034] According to the business encapsulation structure, the business data is encapsulated to obtain business encapsulation data, and the business encapsulation data is serialized to obtain business sequence data;

[0035] According to the message encapsulation structure, the preset message basic data is obtained, the business sequence data and the message basic data are encapsulated to obtain the message encapsulation data, and the message encapsulation data is serialized to obtain structured data; the message basic data is data related to the business scenario associated with the business data.

[0036] Optionally, the device in the embodiment of the present invention further includes:

[0037] A first determining module, used to determine the data length of the service encapsulation data;

[0038] The determination module is used to determine whether the data length of the service encapsulation data is greater than a preset first threshold.

[0039] Optionally, multiple serialization methods are pre-set; the device of the embodiment of the present invention also includes:

[0040] A second determination module is used to determine a business scenario associated with the business data;

[0041] The screening module is used to determine the target serialization method from multiple serialization methods according to the business scenario. The target serialization method is used to serialize the business encapsulation data and the message encapsulation data.

[0042] Optionally, the encapsulation module is further used to:

[0043] Get multiple package information of structured data;

[0044] According to the preset byte alignment rules, determine the arrangement order and byte length of multiple encapsulation information and structured data;

[0045] According to the arrangement order and byte length, multiple encapsulation information and structured data are encapsulated, and the encapsulated data is used as transmission data.

[0046] Optionally, the apparatus of the embodiment of the present invention further includes: a third determining module, configured to determine the data length of the structured data; a compression module, configured to perform a data compression operation on the structured data in response to the data length of the structured data being greater than a preset second threshold value, to obtain compressed data;

[0047] The encapsulation module is also used to encapsulate the compressed data according to a preset transmission protocol, and use the encapsulated compressed data as transmission data.

[0048] According to a fourth aspect of an embodiment of the present invention, a data transmission device is provided, including:

[0049] The parsing module is used to parse the received return data to obtain the second structured data according to the preset transmission protocol; the return data is obtained by the following steps: encapsulating the acquired first business data according to the preset nested data structure, performing multiple structure serialization operations on the multi-layer data in the encapsulated first business data to obtain the first structured data, and encapsulating the first structured data to obtain the return data that complies with the transmission protocol;

[0050] A deserialization module, used to perform multiple deserialization operations on the multi-layer data in the second structured data according to a preset nested data structure to obtain second business data;

[0051] The return module is used to transmit the second service data to a receiver corresponding to the return data.

[0052] According to a fifth aspect of an embodiment of the present invention, there is provided an electronic device, including:

[0053] one or more processors;

[0054] a storage device for storing one or more programs,

[0055] When one or more programs are executed by one or more processors, the one or more processors implement the method of any of the above embodiments.

[0056] According to a sixth aspect of an embodiment of the present invention, there is provided a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the method of any of the above embodiments is implemented.

[0057] According to a seventh aspect of an embodiment of the present invention, there is provided a computer program product, including a computer program, which implements the method of any of the above embodiments when executed by a processor.

[0058] One embodiment of the above invention has the following advantages or beneficial effects: based on multiple serialization operations and encapsulation operations, the business data is converted into transmission data with a small data volume, which can improve the transmission efficiency of the transmission data, shorten the data transmission time, and save system resources; firstly, the business sequence data is obtained by encapsulation and serialization, and then the message sequence data is obtained by encapsulation and serialization, which can encapsulate the business-related data and the data with the same business scenario in different data layers, improve the readability of the data, ensure the integrity of the data, and facilitate the parsing of the encapsulated data; when the data length of the business encapsulation data is greater than the first threshold, the business encapsulation data is serialized again, which can save system resources. source, improving data encapsulation efficiency; determining the serialization method based on the business scenario can improve the efficiency and effect of data serialization and make the serialized data smaller; determining the arrangement order and byte length of multiple encapsulation information and structured data based on the byte alignment rule can improve the data encapsulation efficiency and accuracy, ensure the byte alignment of the encapsulated data, reduce the data volume, and improve the transmission efficiency; when the data length of the structured data is greater than the second threshold, performing the compression operation can save system resources and reduce the data volume; parsing the returned data into the second business data according to the transmission protocol and the nested structure data can improve the parsing efficiency of the returned data and ensure the communication efficiency between multiple terminals.

[0059] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0061] Figure 1 is a schematic diagram of the main process of the data transmission method according to an embodiment of the present invention;

[0062] Figure 2 is a schematic diagram of a transmission protocol according to a reference embodiment of the present invention;

[0063] Figure 3 is a schematic diagram of the main process of data encapsulation according to a reference embodiment of the present invention;

[0064] Figure 4 is a schematic diagram of a main process of data transmission according to a reference embodiment of the present invention;

[0065] Figure 5 is a schematic diagram of the main process of another data transmission method according to an embodiment of the present invention;

[0066] Figure 6 is a schematic diagram of a main process of data transmission according to a reference embodiment of the present invention;

[0067] Figure 7 is a schematic diagram of main modules of a device for data transmission according to an embodiment of the present invention;

[0068] Figure 8 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0069] Fig. 9 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0070] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0071] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing and transfer of user personal information involved are in compliance with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the user's consent or authorization. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted.

[0072] In the field of instant messaging, multiple terminals establish message channels through basic networks and network communication protocols, and transmit data through the message channels. When transmitting communication data such as text and images, there are usually two methods. One method is to directly encapsulate the data to be transmitted into transmission data that conforms to the transmission protocol, and then transmit the transmission data. The other method is to perform one or more compression operations on the data to be transmitted, and then encapsulate the compressed data into transmission data, and then transmit the transmission data.

[0073] The compressed data volume is still relatively large, resulting in low data transmission efficiency, long data transmission time, and the need to consume a lot of system resources when transmitting data. When the compression method of multiple compression operations is the same, the compression effect is not significantly improved, but a lot of system resources are consumed; when the compression methods of multiple compression operations are different, a lot of compression costs are increased, and a lot of system resources are consumed.

[0074] In view of this, according to a first aspect of an embodiment of the present invention, a method for data transmission is provided.

[0075] Figure 1 FIG. 1 is a schematic diagram of the main flow of the method for data transmission according to an embodiment of the present invention. Figure 1 As shown, the data transmission method according to the embodiment of the present invention mainly includes the following steps S101 to S103.

[0076] Step S101 , encapsulating the acquired business data according to a preset nested data structure, and performing multiple serialization operations on the multi-layer data in the encapsulated business data to obtain structured data.

[0077] Business data is data related to business logic that is transmitted between multiple terminals. For example, in the instant messaging business scenario, business data includes chat messages between different users, in the e-commerce business scenario, business data includes conversations between consumers and customer service, in the online consultation business scenario, business data includes conversations between doctors and patients, etc. Business data has the characteristics of high transmission frequency and large data volume. Business data can be data in different formats such as text, images, audio, video, etc.

[0078] After the execution subject of the embodiment of the present invention receives the business data, the business data is serialized according to the preset nested data structure. The nested data structure is formed by multiple layers of data structures being nested with each other. Each layer of the data structure includes a data header and a data body. Each layer of data is the data body of the outer layer of data. The data header of each layer of data is different or partially the same. The received business data is the innermost data in the nested data structure. It should be noted that the data body of each layer is serialized data, and the serialized data is binary data. The serialization methods applicable to the embodiment of the present invention include: a serialization method based on the Protocol Buffers (referred to as protobuf) protocol, and a serialization method based on the FlatBuffers serialization library; wherein, Protocol Buffers is an open source serialization protocol that converts structured data from one form to another, and FlatBuffers is a cross-platform serialization library with high memory efficiency and compatibility.

[0079] Exemplarily, the pre-set nested structure data includes three layers. The execution subject of the embodiment of the present invention takes the business data as the first layer data; then obtains the data header of the second layer data, including: the business field to which the business data belongs, the reception time of the business data, the size of the business data, the type of business data, etc., performs a serialization operation on the first layer data, uses the serialized first layer data as the data body of the second layer data, encapsulates the data header and data body of the second layer data, and obtains the second layer data; then obtains the data header of the third layer data, including: the transmission method of the business data, the network location to which the business data is transmitted, the verification information of the business data, etc.; performs a serialization operation on the second layer data, uses the serialized second layer data as the data body of the third layer data, encapsulates the data header and data body of the third layer data, and obtains the third layer data; then performs a serialization operation on the third layer data, and uses the serialized third layer data as the structured data.

[0080] Based on the nested data structure, the business data is encapsulated in multiple layers and each layer of data is serialized, which can reduce the volume of each layer of data, improve the transmission efficiency of business data, reduce transmission costs, and save system resources.

[0081] According to a reference embodiment of the present invention, the nested data structure includes: a business encapsulation structure and a message encapsulation structure. The business encapsulation structure defines the fields included in the business encapsulation data and the data types corresponding to the fields. The message encapsulation structure defines the fields included in the message encapsulation data and the data types corresponding to the fields. When multiple serialization operations are performed on the business data according to the preset nested data structure, the business data is first encapsulated according to the business encapsulation structure to obtain the business encapsulation data. Specifically, the business encapsulation structure includes: image information, title information, description information, time information, price information, click type, jump link, etc. of the business data, wherein the data types of the image information, title information, description information, price information, and jump link are strings (String), the data type of the time information is an integer type (UInt64), and the data type of the price information is an integer type (Int32).

[0082] For example, in the field of e-commerce business, a consumer sends a chat message to a customer service representative, "Excuse me, is this dress in stock?" and attaches a picture and a link. The executive subject of the embodiment of the present invention parses the above business data according to the business encapsulation structure, uses the attached picture as the image information of the business data, uses the attached link as the jump link of the business data, uses the chat message as the description information of the business data, uses the receiving time of the business data as the time information, parses the jump link, and uses the product name corresponding to the link as the title information. Since there are chat entrances between consumers and customer service on multiple pages such as the product list page and the product details page, the chat entrance clicked by the consumer is used as the click type. The above business data is encapsulated to obtain business encapsulation data, and the business encapsulation data is serialized to obtain business sequence data.

[0083] According to the message encapsulation structure, the pre-set message basic data is obtained, and the business sequence data and the message basic data are encapsulated to obtain the message encapsulation data; wherein the message basic data is data related to the business scenario associated with the business data, and specifically can be data containing the field values ​​of each field defined by the message encapsulation structure. Specifically, the message encapsulation structure includes: message coding, message token, message source, message destination, message basic type, message version, message timestamp, business data type, business data structured type, business data, etc., wherein the data types of the message coding, message token, message basic type, message version, business data type, and business data are strings (String), the data types of the message source and message destination are optional unique identifiers (optional UID), the data type of the message timestamp is an integer type (UInt64), and the data type of the business data structured type is an integer type (Int32).

[0084] Exemplarily, in the field of e-commerce business, the chat information between consumers and customer service is the basic data of the message. Each chat message between consumers and customer service has a corresponding message code. Each time a new chat message is received, the message code is incremented by 1. The corresponding message token is obtained according to the business data. The network address of the sender of the business data is used as the source of the message. The network address of the receiver of the business data specified by the sender is used as the destination of the message. When the business data only includes text, the basic type of the message is determined to be text. When the business data also includes images, the basic type of the message is determined to be text. When the business data includes videos, the basic type of the message is determined to be video. The time of receiving the business data is used as the message timestamp. The data type included in the business sequence data is used as the business data type. The serialization method of the business sequence data is used as the business data structured type. The business sequence data is used as the business data of the message encapsulation data, that is, the data body. The above message encapsulation data is serialized to obtain the message sequence data, and the message sequence data is used as the structured data.

[0085] Preferably, the serialization method for serializing the service encapsulation data and the serialization method for serializing the message encapsulation data are the same, for example, both use the Protocol Buffers serialization protocol to perform serialization operations on the service encapsulation data and the message encapsulation data.

[0086] First, business sequence data is obtained through encapsulation and serialization, and then message sequence data is obtained through encapsulation and serialization. Business-related data and data with the same business scenario can be encapsulated in different data layers, which improves data readability, ensures data integrity, and facilitates parsing of encapsulated data.

[0087] According to another reference embodiment of the present invention, before serializing the service encapsulation data to obtain the service sequence data, the data length of the service encapsulation data is determined. The data length of the service encapsulation data is compared with a preset first threshold value to determine whether the data length of the service encapsulation data is greater than the first threshold value. If the data length of the service encapsulation data is greater than the first threshold value, the service encapsulation data is serialized to obtain the service sequence data; if the data length of the service encapsulation data is less than or equal to the first threshold value, the service encapsulation data is not serialized, and the service encapsulation data is directly used as the service sequence data. It should be noted that the first threshold value is configurable, and the execution subject of the embodiment of the present invention raises or lowers the first threshold value according to the threshold value configuration request.

[0088] Exemplarily, the first threshold value is preset to 30 bytes. Different programming languages ​​have different length calculation methods. When using the Java programming language, the method "data.length()" is used to determine the data length of the business encapsulation data, where "data" represents the business encapsulation data, and the number obtained by this method is the data length of the business encapsulation data; the business encapsulation data is compared with the first threshold value. For example, if the data length of the business encapsulation data is 25 bytes, the business encapsulation data does not need to be serialized, and the business encapsulation data is directly used as the business sequence data; for another example, if the data length of the business data is 35 bytes, the business encapsulation data is serialized as the business sequence data.

[0089] When the data length of the service encapsulation data is greater than the first threshold, serializing the service encapsulation data can save system resources and improve data encapsulation efficiency.

[0090] According to another reference embodiment of the present invention, multiple serialization methods are pre-set, and the serialization methods applicable to the embodiments of the present invention include: a serialization method based on the Protocol Buffers protocol, a serialization method based on the FlatBuffers serialization library, a Serializable method based on the Java IO interface, a JSON serialization method based on the third-party open source class package Jackson, and the like.

[0091] Before serializing the business encapsulation data, the business scenario associated with the business data can be determined. For example, when receiving business data, business scenario information associated with the business data is received, and a data field is used to represent the business scenario information. The business scenario information corresponding to the data field "ebusiness" is the e-commerce business scenario, the business scenario information corresponding to the data field "chat" is the instant messaging business scenario between different users, and the business scenario information corresponding to the data field "askDoc" is the online consultation business scenario.

[0092] The association between the business scenario and the serialization method is preset, each business scenario corresponds to a serialization method, and a serialization method can be used for multiple business scenarios. After determining the business scenario corresponding to the business data, the target serialization method corresponding to the business scenario is determined from a plurality of serialization methods, and the target serialization method is used to serialize the business encapsulation data and the message encapsulation data. Exemplarily, the serialization method corresponding to the e-commerce business scenario is a serialization method based on the Protocol Buffers protocol, the serialization method corresponding to the online consultation business scenario is a serialization method based on the FlatBuffers serialization library, and the serialization method corresponding to the instant messaging business scenario is a JSON serialization method based on the third-party open source class package jackson. In the case where the business data is an e-commerce business scenario, the serialization method based on the Protocol Buffers protocol is used as the target serialization method, and the target serialization method is used to serialize the business encapsulation data to obtain the business sequence data.

[0093] It should be noted that the serialization method for serializing business encapsulation data is configurable. The execution subject of the embodiment of the present invention adds new serialization methods, disables existing serialization methods, and modifies the association between business scenarios and serialization methods based on the received method update request.

[0094] Determining the serialization method based on the business scenario can improve the efficiency and effectiveness of data serialization and make the volume of serialized data smaller; adding or deactivating serialization methods and modifying the relationship between business scenarios and serialization methods according to business needs can improve the flexibility of serialization operations and use different serialization methods to meet business needs.

[0095] Step S102, encapsulating the structured data according to a preset transmission protocol to obtain transmission data that complies with the transmission protocol.

[0096] The pre-set transmission protocol can be an existing data transmission protocol, such as TCP protocol, UDP protocol, etc., or a custom data transmission protocol. The transmission protocol is used to specify the transmission rules that the transmission data between multiple terminals should comply with. Specifically, the transmission protocol specifies the data format, data content, maximum message length, data transmission mechanism, etc. of the transmission data. After the structured data is generated, the structured data is encapsulated according to the pre-set transmission protocol, and the structured data is encapsulated into transmission data. The encapsulated transmission data complies with the provisions of the transmission protocol.

[0097] Exemplarily, the TCP protocol is used to encapsulate structured data, and the structured data is used as the body data of the TCP protocol. The header corresponding to the TCP protocol is obtained, including: source port number, destination port number, data offset bit, reserved word, check bit and other data. The above header and header data are encapsulated to obtain transmission data that complies with the TCP protocol.

[0098] Encapsulating structured data according to the transmission protocol can ensure that the transmitted data complies with the transmission protocol, facilitate accurate and efficient data transmission, and improve the success rate of data transmission.

[0099] According to a reference embodiment of the present invention, when encapsulating structured data according to a preset transmission protocol, a custom transmission protocol is used to obtain multiple encapsulation information corresponding to the structured data, and the multiple encapsulation information includes: the protocol code or version number of the transmission protocol, whether the structured data is compressed, the data type of the structured data, reserved words, and the data length of the structured data. According to the preset byte alignment rule, the arrangement order and byte length of the multiple encapsulation information and the structured data are determined, wherein the arrangement order is the arrangement order of each encapsulation information, for example, which encapsulation information is arranged in front, which encapsulation information is arranged in the back, and the arrangement order of the structured data relative to the multiple encapsulation information; the byte length is the maximum byte length allocated to each encapsulation information and the structured data, and the byte lengths of different encapsulation information can be the same or different, and the byte length of the encapsulation information cannot be greater than the maximum byte length allocated to it, and the data length of the structured data cannot be greater than the maximum byte length allocated to it.

[0100] Figure 2 Schematic diagram of a transmission protocol according to a reference embodiment of the present invention. For example, the pre-set transmission protocol is: IMTP (Instant Messaging Transfer Protocol), and the data structure of the transmission data conforming to the IMTP transmission protocol is as follows: Figure 2As shown, specifically, data is grouped with 4-byte 32-bit binary data; the first byte (the first 4 bits) is the version number, the maximum version number is 16, and setting the version number facilitates version compatibility judgment; the first byte (the last 4 bits) is the compression type, wherein, when the compression type is 0, it means that the structured data is not compressed, and the compression type greater than zero corresponds to different compression algorithm enumeration values, such as the compression algorithm corresponding to the compression type 1 is the ZLIB compression algorithm; the second byte (the first 4 bits) is the data type, and the data type can reflect the serialization method of the structured data, wherein the data type of 0 represents the original data, the data type of 1 represents Json data, the data type of 2 represents ProtoBuffer data, and the data type of 3 represents FlatBuffer data; the second byte (the last 4 bits), the third byte, and the fourth byte are reserved words; the fifth to eighth bytes are the data length of the structured data, and the structured data is after the eighth byte.

[0101] The arrangement order and byte length of multiple encapsulation information and structured data are determined according to the transmission protocol, and the multiple encapsulation information and structured data are encapsulated, and the encapsulated data is used as the transmission data, and the transmission data complies with the transmission rules corresponding to the transmission protocol. Based on the byte alignment rule, the arrangement order and byte length of multiple encapsulation information and structured data are determined, which can improve the efficiency and accuracy of data encapsulation, ensure the byte alignment of the encapsulated data, reduce the data volume, and improve the transmission efficiency.

[0102] According to another reference embodiment of the present invention, before encapsulating the structured data, the data length of the structured data is determined, the data length of the structured data is compared with a preset second threshold value, and it is determined whether the data length of the structured data is greater than the second threshold value. When the data length of the structured data is greater than the second threshold value, a data compression operation is performed on the structured data to obtain compressed data. Specifically, a plurality of data compression methods are pre-set, for example, a ZLIB compression algorithm, a GZIP compression algorithm, a 7z compression algorithm, and the like. According to information such as the data length and serialization method of the structured data, a target data compression method is determined from a plurality of data compression methods, and the structured data is compressed using the target data compression method. It should be noted that the second threshold value is configurable, and the execution subject of the embodiment of the present invention raises or lowers the second threshold value according to the threshold value configuration request.

[0103] After the structured data is compressed, when the structured data is encapsulated according to a preset transmission protocol, the compressed data is encapsulated according to the preset transmission protocol, and the encapsulated compressed data is used as transmission data.

[0104] When the data length of the structured data is greater than the second threshold, performing the compression operation can save system resources and reduce the data volume.

[0105] Step S103: transmit the transmission data to a recipient corresponding to the business data.

[0106] After the transmission data is generated, the receiver of the business data is determined, that is, to which network address the business data is transmitted, for example, when receiving the business data, the starting network address and the destination network address corresponding to the business data are received, wherein the starting network address represents the sender of the business data, and the destination network address represents the receiver of the business data. The execution subject of the embodiment of the present invention transmits the transmission data to the receiver of the business data, preferably, waits for the response information returned by the receiver, the response information indicates that the receiver has successfully received the transmission data, and after receiving the response information returned by the receiver, the data transmission process ends.

[0107] Figure 3 FIG. 1 is a schematic diagram of the main process of data encapsulation according to a reference embodiment of the present invention. Figure 3 As shown, the business data received by the execution subject of the embodiment of the present invention includes: image business data and text business data, the image business data and the text business data are encapsulated into business encapsulation data, the business encapsulation data is encapsulated and serialized into business sequence data, the business sequence data and message basic data are encapsulated into message encapsulation data, the message encapsulation data is serialized into message sequence data, the message sequence data is compressed into structured data, the structured data and multiple encapsulation information such as version number and compression type are encapsulated to obtain transmission data.

[0108] Figure 4 FIG. 1 is a schematic diagram of the main flow of data transmission according to a reference embodiment of the present invention. Figure 4 As shown, the execution subject of the embodiment of the present invention encapsulates the received business data into business encapsulation data, and determines whether the data length of the business encapsulation data is greater than a preset first threshold. If so, the business encapsulation data is serialized into business sequence data, otherwise, the business encapsulation data is directly used as business sequence data; then the business sequence data and the message basic data are encapsulated into message encapsulation data, the message encapsulation data is serialized into message sequence data, and the message sequence data is used as structured data; then, depending on whether the data length of the structured data is greater than a preset second threshold, if so, the structured data is compressed, otherwise, the structured data is not compressed; then the encapsulation information is obtained, multiple encapsulation information and structured data are encapsulated into transmission data, and the transmission data is transmitted.

[0109] Figure 5FIG. 1 is a schematic diagram of the main flow of a method for data transmission according to a reference embodiment of the present invention. Figure 5 As shown, the data transmission method may include:

[0110] Step S501, encapsulating the acquired business data according to a preset nested data structure, and performing multiple serialization operations on the multi-layer data in the encapsulated business data to obtain structured data;

[0111] Step S502, obtaining basic message data according to the message encapsulation structure;

[0112] Step S503, encapsulating the business sequence data and the message basic data into message encapsulation data, serializing the message encapsulation data into message sequence data, and using the message sequence data as structured data;

[0113] Step S504, performing data compression on the structured data to obtain compressed data;

[0114] Step S505, encapsulating the compressed data according to a preset transmission protocol to obtain transmission data that complies with the transmission protocol;

[0115] Step S506: transmit the transmission data to a recipient corresponding to the business data.

[0116] The specific implementation content of the data transmission method of the above-mentioned reference embodiment of the present invention has been described in detail in the above-mentioned data transmission method, so the repeated content will not be described here.

[0117] According to a second aspect of an embodiment of the present invention, another method for data transmission is provided, comprising: parsing second structured data from received return data according to a preset transmission protocol; performing multiple deserialization operations on multi-layer data in the second structured data according to a preset nested data structure to obtain second business data; and transmitting the second business data to a recipient corresponding to the return data. Parsing the return data into the second business data according to the transmission protocol and the nested structure data can improve the parsing efficiency of the return data and ensure the communication efficiency between multiple terminals.

[0118] The return data is the data returned by the recipient of the business data, and the return data complies with the transmission rules corresponding to the transmission protocol, such as the data format, data content, maximum message length, data transmission mechanism, etc. The return data in the embodiment of the present invention is the transmission data generated and transmitted by any one of the methods provided in the first aspect of the embodiment of the present invention, for example, according to a pre-set nested data structure, the acquired first business data is encapsulated, and multiple serialization operations are performed on the multi-layer data in the encapsulated first business data to obtain the first structured data, and the first structured data is encapsulated to obtain the return data that complies with the transmission protocol. The process of obtaining the transmission data has been described in detail in the data transmission method of the first aspect of the embodiment of the present invention, so the repeated content will not be described here. According to the transmission protocol, the second structured data parsed from the return data complies with the pre-set nested data structure, and the second structured data is deserialized according to the nested data structure. Exemplarily, the nested data structure includes: a business encapsulation structure and a message encapsulation structure, the message encapsulation data is used as the first message encapsulation data, the second structured data is first deserialized to obtain the second message encapsulation data, the data body, i.e., the second business sequence data, is obtained from the second message encapsulation data, and then the second business sequence data is serialized to obtain the second business encapsulation data, the data body is obtained from the second business encapsulation data to obtain the second business data.

[0119] The recipient corresponding to the returned data may be any subject that can receive the second business data sent by the execution subject of this embodiment. Figure 6 FIG. 1 is a schematic diagram of the main flow of data transmission according to a reference embodiment of the present invention. Figure 6 As shown, according to the transmission protocol, the execution subject of the embodiment of the present invention parses the structured data from the received return data and determines whether the structured data is compressed. If so, the structured data is parsed; otherwise, the structured data is not decompressed, and then the structured data is deserialized into message encapsulation data, and business sequence data is parsed from the message encapsulation data according to the nested data structure; determines whether the business sequence data is serialized, and if so, the business sequence data is deserialized into business encapsulation data, otherwise, the business sequence data is directly used as business encapsulation data; then, according to the nested data structure, the returned business data is parsed from the business encapsulation data, and the returned business data is transmitted.

[0120] In an optional embodiment, the execution subject of the method provided in the second aspect of the embodiment of the present invention is the same as the execution subject of the method provided in the first aspect of the embodiment of the present invention. In this case, the receiver corresponding to the feedback data is the sender of the business data received by the execution subject of the embodiment of the present invention. In the actual application process, it is also possible to wait for the response information returned by the receiver of the feedback data, and the response information indicates that the receiver of the feedback data has successfully received the feedback data. After returning the received response information to the sender of the feedback data, the data parsing process ends.

[0121] According to a third aspect of an embodiment of the present invention, a data transmission device is provided.

[0122] Figure 7 is a schematic diagram of main modules of a data transmission device according to an embodiment of the present invention, such as Figure 7 As shown, the data transmission device 700 mainly includes:

[0123] The serialization module 701 is used to encapsulate the acquired business data according to a preset nested data structure, and perform multiple serialization operations on the multi-layer data in the encapsulated business data to obtain structured data;

[0124] The encapsulation module 702 is used to encapsulate the structured data according to a preset transmission protocol to obtain transmission data that complies with the transmission protocol;

[0125] The transmission module 703 is used to transmit the transmission data to the receiver corresponding to the business data.

[0126] According to a reference embodiment of the present invention, the nested data structure includes: a business encapsulation structure and a message encapsulation structure, the business encapsulation structure defines the fields included in the business encapsulation data and the data types corresponding to the fields, and the message encapsulation structure defines the fields included in the message encapsulation data and the data types corresponding to the fields; the serialization module 701 is also used to:

[0127] According to the business encapsulation structure, the business data is encapsulated to obtain business encapsulation data, and the business encapsulation data is serialized to obtain business sequence data;

[0128] According to the message encapsulation structure, the preset message basic data is obtained, the business sequence data and the message basic data are encapsulated to obtain the message encapsulation data, and the message encapsulation data is serialized to obtain structured data; the message basic data is data related to the business scenario associated with the business data.

[0129] According to another reference embodiment of the present invention, the data transmission device 700 further includes:

[0130] A first determining module, used to determine the data length of the service encapsulation data;

[0131] The determination module is used to determine whether the data length of the service encapsulation data is greater than a preset first threshold.

[0132] According to another reference embodiment of the present invention, multiple serialization methods are preset; the data transmission device 700 also includes:

[0133] A second determination module is used to determine a business scenario associated with the business data;

[0134] The screening module is used to determine the target serialization method from multiple serialization methods according to the business scenario. The target serialization method is used to serialize the business encapsulation data and the message encapsulation data.

[0135] According to another reference embodiment of the present invention, the encapsulation module 702 is further used for:

[0136] Get multiple encapsulation information of structured data;

[0137] According to the preset byte alignment rules, determine the arrangement order and byte length of multiple encapsulation information and structured data;

[0138] According to the arrangement order and byte length, multiple encapsulation information and structured data are encapsulated, and the encapsulated data is used as transmission data.

[0139] According to another reference embodiment of the present invention, the data transmission device 700 further includes: a third determination module, configured to determine the data length of the structured data; a compression module, configured to perform a data compression operation on the structured data in response to the data length of the structured data being greater than a preset second threshold value, to obtain compressed data;

[0140] The encapsulation module 702 is further used to encapsulate the compressed data according to a preset transmission protocol, and use the encapsulated compressed data as transmission data.

[0141] According to a fourth aspect of an embodiment of the present invention, a data transmission device is provided, including:

[0142] The parsing module is used to parse the received return data to obtain the second structured data according to the preset transmission protocol; the return data is obtained by the following steps: encapsulating the acquired first business data according to the preset nested data structure, performing multiple serialization operations on the multi-layer data in the encapsulated first business data to obtain the first structured data, and encapsulating the first structured data to obtain the return data that complies with the transmission protocol;

[0143] A deserialization module, used to perform multiple deserialization operations on the multi-layer data in the second structured data according to a preset nested data structure to obtain second business data;

[0144] The return module is used to transmit the second service data to a receiver corresponding to the return data.

[0145] It should be noted that the specific implementation content of the data transmission device in the embodiment of the present invention has been described in detail in the above data transmission method, so the repeated content will not be described again here.

[0146] According to the technical solution of the embodiment of the present invention, based on multiple serialization operations and encapsulation operations, the business data is converted into transmission data with a small data volume, which can improve the transmission efficiency of the transmission data, shorten the data transmission time, and save system resources; firstly, the business sequence data is obtained by encapsulation and serialization, and then the message sequence data is obtained by encapsulation and serialization, which can encapsulate the business-related data and the data with the same business scenario in different data layers, improve the readability of the data, ensure the integrity of the data, and facilitate the parsing of the encapsulated data; when the data length of the business encapsulation data is greater than the first threshold, the business encapsulation data is serialized again, which can save system resources and improve the data. The invention improves data encapsulation efficiency; determines the serialization method based on the business scenario, which can improve the efficiency and effect of data serialization and make the serialized data smaller; determines the arrangement order and byte length of multiple encapsulation information and structured data based on the byte alignment rule, which can improve the data encapsulation efficiency and accuracy, ensure the byte alignment of the encapsulated data, reduce the data volume and improve the transmission efficiency; performs compression operation when the data length of the structured data is greater than the second threshold, which can save system resources and reduce the data volume; parses the returned data into the second business data according to the transmission protocol and the nested structure data, which can improve the parsing efficiency of the returned data and ensure the communication efficiency between multiple terminals.

[0147] According to the fifth aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided by the first aspect of the embodiment of the present invention.

[0148] According to a sixth aspect of an embodiment of the present invention, there is provided a computer-readable medium having a computer program stored thereon, and when the program is executed by a processor, the method provided in the first aspect of the embodiment of the present invention is implemented.

[0149] According to a seventh aspect of an embodiment of the present invention, there is provided a computer program product, including a computer program, which implements the method of any of the above embodiments when executed by a processor.

[0150] Figure 8 An exemplary system architecture 800 is shown to which the method for data transmission or the apparatus for data transmission according to the embodiments of the present invention may be applied.

[0151] like Figure 8 As shown, system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. Network 804 is used to provide a medium for communication links between terminal devices 801, 802, 803 and server 805. Network 804 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0152] Users can use terminal devices 801, 802, and 803 to interact with server 805 through network 804 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 801, 802, and 803, such as data transmission applications, data processing applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0153] The terminal devices 801 , 802 , and 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0154] The server 805 may be a server that provides various services, such as a background management server (only as an example) that provides support for data transmission requests sent by the upstream terminal devices 801, 802, and 803. The background management server may encapsulate the acquired business data according to a preset nested data structure, and perform multiple serialization operations on the multi-layer data in the encapsulated business data to obtain structured data; encapsulate the structured data according to a preset transmission protocol to obtain transmission data that complies with the transmission protocol; transmit the transmission data to the recipient corresponding to the business data; and feed back the data transmission situation (only as an example) to the terminal device.

[0155] It should be noted that the data transmission method provided in the embodiment of the present invention is generally performed by the server 805, and accordingly, the data transmission device is generally set in the server 805. The data transmission method provided in the embodiment of the present invention can also be performed by the terminal devices 801, 802, and 803, and accordingly, the data transmission device can be set in the terminal devices 801, 802, and 803.

[0156] It should be understood that Figure 8 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0157] Reference below Fig. 9 , which shows a schematic diagram of the structure of a computer system 900 of a terminal device suitable for implementing an embodiment of the present invention. Fig. 9 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0158] like Fig. 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0159] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage section 908 as needed.

[0160] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-mentioned functions defined in the system of the embodiment of the present invention are executed.

[0161] It should be noted that the computer-readable medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The 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 of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In an embodiment of the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In an embodiment of the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0162] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0163] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, they may be described as: a processor includes a serialization module, an encapsulation module, and a transmission module, wherein the names of these modules do not constitute a limitation on the module itself in some cases, for example, the serialization module may also be described as "a module that performs multiple serialization operations on multiple layers of data in the encapsulated business data".

[0164] As another aspect, an embodiment of the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device implements the following method: encapsulate the acquired business data according to a preset nested data structure, and perform multiple serialization operations on the multi-layer data in the encapsulated business data to obtain structured data; encapsulate the structured data according to a preset transmission protocol to obtain transmission data that complies with the transmission protocol; and transmit the transmission data to the recipient corresponding to the business data.

[0165] According to the technical solution of the embodiment of the present invention, based on multiple serialization operations and encapsulation operations, the business data is converted into transmission data with a small data volume, which can improve the transmission efficiency of the transmission data, shorten the data transmission time, and save system resources; firstly, the business sequence data is obtained by encapsulation and serialization, and then the message sequence data is obtained by encapsulation and serialization, which can encapsulate the business-related data and the data with the same business scenario in different data layers, improve the readability of the data, ensure the integrity of the data, and facilitate the parsing of the encapsulated data; when the data length of the business encapsulation data is greater than the first threshold, the business encapsulation data is serialized again, which can save system resources and improve the data. The invention improves data encapsulation efficiency; determines the serialization method based on the business scenario, which can improve the efficiency and effect of data serialization and make the serialized data smaller; determines the arrangement order and byte length of multiple encapsulation information and structured data based on the byte alignment rule, which can improve the data encapsulation efficiency and accuracy, ensure the byte alignment of the encapsulated data, reduce the data volume and improve the transmission efficiency; performs compression operation when the data length of the structured data is greater than the second threshold, which can save system resources and reduce the data volume; parses the returned data into the second business data according to the transmission protocol and the nested structure data, which can improve the parsing efficiency of the returned data and ensure the communication efficiency between multiple terminals.

[0166] The above specific implementations do not constitute a limitation on the protection scope of the embodiments of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.

Claims

1. A method for data transmission, characterized in that: include: According to the preset nested data structure, the acquired business data is encapsulated, and multiple serialization operations are performed on the multi-layer data in the encapsulated business data to obtain structured data; Encapsulating the structured data according to a preset transmission protocol to obtain transmission data that complies with the transmission protocol; The transmission data is transmitted to a recipient corresponding to the service data.

2. The method according to claim 1, characterized in that The nested data structure includes: a business encapsulation structure and a message encapsulation structure, the business encapsulation structure defines the fields included in the business encapsulation data and the data types corresponding to the fields, and the message encapsulation structure defines the fields included in the message encapsulation data and the data types corresponding to the fields; according to the preset nested data structure, multiple serialization operations are performed on the business data to obtain structured data, including: encapsulating the service data according to the service encapsulation structure to obtain service encapsulation data, and serializing the service encapsulation data to obtain service sequence data; According to the message encapsulation structure, the preset message basic data is obtained, the business sequence data and the message basic data are encapsulated to obtain message encapsulation data, and the message encapsulation data is serialized to obtain the structured data; the message basic data is data related to the business scenario associated with the business data.

3. The method according to claim 2, characterized in that Before serializing the service encapsulation data to obtain service sequence data, the method further includes: Determining the data length of the service encapsulation data; It is determined that the data length of the service encapsulation data is greater than a preset first threshold.

4. The method according to claim 2, characterized in that: Presetting a plurality of serialization methods; before serializing the service encapsulation data, the method further comprises: Determining a business scenario associated with the business data; According to the business scenario, a target serialization method is determined from the multiple serialization methods, and the target serialization method is used to serialize the business encapsulation data and the message encapsulation data.

5. The method according to claim 1, characterized in that According to a preset transmission protocol, the structured data is encapsulated to obtain transmission data that complies with the transmission protocol, including: Acquire multiple packaging information of the structured data; Determine the arrangement order and byte length of the plurality of encapsulation information and the structured data according to a preset byte alignment rule; The plurality of encapsulation information and the structured data are encapsulated according to the arrangement order and the byte length, and the encapsulated data is used as the transmission data.

6. The method according to claim 1, characterized in that Before encapsulating the structured data, the method further includes: determining the data length of the structured data; in response to the data length of the structured data being greater than a preset second threshold, performing a data compression operation on the structured data to obtain compressed data; Encapsulating the structured data according to a preset transmission protocol includes: encapsulating the compressed data according to a preset transmission protocol to obtain the transmission data.

7. A method for data transmission, characterized in that: include: Parsing the received return data to obtain the second structured data according to a preset transmission protocol; The return data is obtained by the following steps: encapsulating the acquired first business data according to a preset nested data structure, performing multiple serialization operations on the multi-layer data in the encapsulated first business data to obtain first structured data, and encapsulating the first structured data to obtain return data that complies with the transmission protocol; According to a preset nested data structure, multiple deserialization operations are performed on the multi-layer data in the second structured data to obtain second business data; The second service data is transmitted to a recipient corresponding to the return data.

8. A data transmission device, characterized in that: include: A serialization module is used to encapsulate the acquired business data according to a preset nested data structure, and perform multiple serialization operations on the multi-layer data in the encapsulated business data to obtain structured data; An encapsulation module, used to encapsulate the structured data according to a preset transmission protocol to obtain transmission data that complies with the transmission protocol; The transmission module is used to transmit the transmission data to a recipient corresponding to the business data.

9. A data transmission device, characterized in that: include: A parsing module, used for parsing the received return data to obtain second structured data according to a preset transmission protocol; The return data is obtained by the following steps: encapsulating the acquired first business data according to a preset nested data structure, performing multiple serialization operations on the multi-layer data in the encapsulated first business data to obtain first structured data, and encapsulating the first structured data to obtain return data that complies with the transmission protocol; A deserialization module, configured to perform multiple deserialization operations on the multi-layer data in the second structured data according to a preset nested data structure, to obtain second business data; The return module is used to transmit the second service data to a recipient corresponding to the return data.

10. An electronic device, characterized in that: include: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

12. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method according to any one of claims 1 to 7.