Data transmission method and device

By establishing a communication link with the broadcast server in the live broadcast system and switching to the cache server when necessary, the efficiency and reliability of the client receiving business data is solved, and the cost of the business server is reduced.

CN119383368APending Publication Date: 2025-01-28SHANGHAI BILIBILI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411546197.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

During the live broadcast process, it is difficult for the client to receive business data effectively, resulting in abnormal live broadcast services. The existing technology requires the self-built polling mechanism of each business module, which increases the cost of the business server.

Method used

By establishing a communication link with a broadcast server to receive target business data, when triggering the predetermined rules, switch from the broadcast server to the cache server, and obtain the target business data from the cache server.

Benefits of technology

Effectively reduce the cost of business server, improve the efficiency and reliability of client business data, and avoid the high cost brought by the rotation mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119383368A_ABST
    Figure CN119383368A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data transmission method. The method comprises the following steps: establishing a communication link with a broadcast server; receiving target service data sent by the broadcast server through the communication link; under the condition that a preset rule is triggered, switching from the broadcast server to the cache server; obtaining the target business data from the cache server; wherein the cache server stores the target business data. According to the technical scheme provided by the embodiment of the invention, the cost of the service server can be effectively reduced, and the acquisition efficiency and reliability of the service data of the client are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of live broadcast technology, and in particular, to a data transmission method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] The live broadcast industry market continues to expand, and the live broadcast industry has penetrated into multiple fields such as entertainment, education, and e-commerce, becoming an important part of the digital economy. At present, during the live broadcast process, a lot of business data such as video connection and voice chat will be generated. In order to enable the client to stably receive business data, each business module often needs to build its own polling mechanism. This method not only leads to high costs for business servers, but also sometimes the client fails to effectively receive business data.

[0003] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention

[0004] The embodiments of the present application provide a data transmission method, apparatus, computer device, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems raised above.

[0005] An aspect of an embodiment of the present application provides a data transmission method, the method comprising: Establishing a communication link with a broadcast server; Receiving target service data sent by the broadcast server through the communication link; When a predetermined rule is triggered, switching from the broadcast server to the cache server; The target business data is obtained from the cache server; wherein the cache server stores the target business data.

[0006] Optionally, the broadcast server includes a first broadcast server and a second broadcast server. The first broadcast server is used to store service data of a first priority, corresponding to a first communication link among the communication links; The second broadcast server is used to store service data of a second priority, corresponding to a second communication link in the communication links; Wherein, receiving the target service data sent by the broadcast server through the communication link includes: When the target service data has a first priority, receiving the target service data through the first communication link; In a case where the target service data has a second priority, the target service data is received through the second communication link.

[0007] Optionally, the cache server is used to store business data of the first priority; When a predetermined rule is triggered, obtaining the target service data from the cache server includes: When the first communication link is abnormal and the target service data has a first priority, the target service data is acquired from the cache server.

[0008] Optionally, the cache server is used to store business data of the first priority; When a predetermined rule is triggered, obtaining the target service data from the cache server includes: Detecting the heartbeat of the first broadcast server; When the heartbeat is abnormal and the target service data is of the first priority, the target service data is obtained from the cache server.

[0009] Optionally, the cache server is used to store business data of the first priority; When a predetermined rule is triggered, obtaining the target service data from the cache server includes: Receiving a push message from the long chain server or the service server, wherein the push message is used to instruct the client to obtain the target service data from the cache server; In a case where the target service data is of the first priority, the target service data is acquired from the cache server according to the push message.

[0010] Optionally, obtaining the target service data from the cache server includes: Pulling service data from the cache server in a polling manner until the communication link with the broadcast server returns to normal; The pulled business data includes the target business data.

[0011] Another aspect of an embodiment of the present application provides a data transmission method for a long chain server, the method comprising: Receiving target business data from a business server; Determining a priority of the target service data, the priority including a first priority and a second priority; When the target service data is of the first priority, sending the target service data to a broadcast server and a cache server respectively; Wherein, the broadcast server is used to forward the target service data to the client; The cache server is used for forwarding the target service data to the client when the broadcast server forwards the target service data abnormally.

[0012] Optionally, the data transmission method further includes: Acquire a transmission status of a communication link from the broadcast server to the client; When the transmission state of the communication link is abnormal and the target service data is of the first priority, an abnormal message is sent to the client, so that the client obtains the target service data from the cache server in a polling manner according to the abnormal message.

[0013] Optionally, the broadcast server includes a first broadcast server and a second broadcast server. The first broadcast server is used to store service data of the first priority. The second broadcast server is used to store the service data of the second priority. Wherein, obtaining the transmission status of the communication link from the broadcast server to the client includes: The transmission status of the communication link from the first broadcast server to the client is obtained to determine whether to send the abnormal message to the client.

[0014] Optionally, the data transmission method further includes: In a case where the target service data is of the second priority level, the target service data is sent to a second broadcast server.

[0015] Another aspect of an embodiment of the present application provides a data transmission method for a service server, the method comprising: Protocol for obtaining target business data; In the case where the target service data is not of the target protocol, encapsulating the target service data to obtain the target service data of the target protocol; The target data of the target protocol is transmitted to the broadcast server or to the broadcast server and the cache server through the long chain server, so that the broadcast server or the cache server forwards the business data of the target protocol to the client; wherein, when the cache server or the broadcast server forwards the business data of the target protocol abnormally, the business data of the target protocol is forwarded to the client.

[0016] Another aspect of an embodiment of the present application provides a data transmission device for a client, the device comprising: An establishing module, used for establishing a communication link with a broadcast server; A receiving module, used for receiving target service data sent by the broadcast server through the communication link; A switching module, configured to switch from the broadcast server to the cache server when a predetermined rule is triggered; The acquisition module is used to acquire the target business data from the cache server; wherein the cache server stores the target business data.

[0017] Another aspect of an embodiment of the present application provides a data transmission device for a long chain server, the device comprising: A receiving module, used for receiving target business data from a business server; A determination module, used to determine the priority of the target service data, wherein the priority includes a first priority and a second priority; A sending module, configured to send the target service data to a broadcast server and a cache server respectively when the target service data has the first priority; Wherein, the broadcast server is used to forward the target service data to the client; The cache server is used for forwarding the target service data to the client when the broadcast server forwards the target service data abnormally.

[0018] Another aspect of an embodiment of the present application provides a data transmission device for a service server, the device comprising: Acquisition module, protocol for acquiring target business data; an encapsulation module, which encapsulates the target service data to obtain target service data of the target protocol when the target service data is not of the target protocol; A transmission module is used to transmit the target data of the target protocol to the broadcast server or to the broadcast server and the cache server through the long link server, so that the broadcast server or the cache server forwards the business data of the target protocol to the client; wherein, when the cache server or the broadcast server forwards the business data of the target protocol abnormally, the business data of the target protocol is forwarded to the client.

[0019] Another aspect of an embodiment of the present application provides a computer device, including: at least one processor; and a memory communicatively coupled to the at least one processor; Wherein: the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.

[0020] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.

[0021] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the method described above when executed by a processor.

[0022] The above technical solution adopted in the embodiment of the present application may have the following advantages: The client receives the target business data from the broadcast server through the communication link. The business data of the broadcast server comes from various business modules in the business server (for example, video connection business, voice chat business, etc.). When the preset rules are triggered, the broadcast server is switched to the cache server storing the target business data, and the target business data is obtained from the cache server. It can be seen that in the embodiment of the present application, when the preset rules are triggered, the client directly obtains the target business data from the cache server without having to continuously request the business server, which effectively reduces the cost of the business server and improves the efficiency and reliability of obtaining client business data. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0024] Figure 1 The operating environment diagram of the data transmission method according to the first embodiment of the present application is schematically shown; Figure 2 The flowchart of the data transmission method according to the first embodiment of the present application is schematically shown; Figure 3 Schematically shows Figure 2 Flow chart of sub-steps of step S202; Figure 4 Schematically shows Figure 2 Flow chart of sub-steps of step S204; Figure 5 Schematically shows Figure 2 Flow chart of sub-steps of step S204; Figure 6 The flowchart of the data transmission method according to the second embodiment of the present application is schematically shown; Figure 7 The newly added flow chart of the data transmission method according to the second embodiment of the present application is schematically shown; Figure 8 The flowchart of the data transmission method according to the third embodiment of the present application is schematically shown; Fig. 9 The following schematically shows an exemplary application flow chart of the present application; Fig.10 A block diagram schematically shows a data transmission device according to a fourth embodiment of the present application; and Fig.11 A block diagram schematically shows a data transmission device according to Embodiment 5 of the present application; and Fig.12 A block diagram schematically shows a data transmission device according to Embodiment 6 of the present application; and Fig.13 The hardware architecture diagram of the computer device according to the seventh embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0026] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0027] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.

[0028] To facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the relevant technologies are described below: The market size of the live streaming industry continues to expand. The live streaming industry has penetrated into multiple fields such as entertainment, education, and e-commerce, becoming an important part of the digital economy.

[0029] However, the applicant understands that a large amount of business data is involved in the live broadcast business. These business data are the core of real-time interaction between anchors and users, and between users. These business data are pushed to the client through independent communication links between each business party and the client (such as long connections established using sockets). However, this type of communication link may cause the business data to not be pushed to the client normally due to various factors such as network instability, which ultimately causes abnormalities in the live broadcast business. At present, in order to ensure the stability of the client receiving business data, the traditional method requires each business party to build its own polling mechanism to ensure the stability of the business, but this method is relatively costly.

[0030] To this end, the present application embodiment provides a data transmission technology solution to overcome the above problems. See below for details.

[0031] Finally, for ease of understanding, an exemplary operating environment is provided below.

[0032] like Figure 1 As shown, the operating environment diagram includes: Business server, long link server, cache server, broadcast server (such as the first broadcast server, the second broadcast server), client, etc.

[0033] The various types of servers described above may be located in a data center such as a single location, or distributed in different geographical locations (e.g., in multiple locations). These servers may provide services via a network. The network includes various network devices such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or the like. The network may include physical links such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof, and the like, or wireless links such as cellular links, satellite links, Wi-Fi links, and the like.

[0034] The client may be configured to access the above-mentioned server to obtain content and services. The client may include a mobile device, a tablet device, a laptop computer, a workstation, a virtual reality device, a gaming device, a digital streaming device, a vehicle terminal, a smart TV, a set-top box, etc., and may also include a virtualized computing instance. The virtualized computing instance may include a virtual machine, such as a simulation of a computer system, an operating system, a server, etc. The computing device may load a virtual machine by the computing device based on a virtual image and / or other data defining specific software (e.g., an operating system, a dedicated application, a server) for simulation. As the demand for different types of processing services changes, different virtual machines may be loaded and / or terminated on one or more computing devices.

[0035] The client may be associated with one or more users. A single user may also use one or more of the clients to obtain business data. The client may include an interface. The interface may include a touchpad, a touch screen, a mouse, a keyboard, or other sensing elements. For example, the input element may be configured to receive user instructions, which may enable the client to perform various operations, such as starting a live broadcast, sending a bullet screen, giving a gift, etc.

[0036] It should be noted that the number of various servers and clients in the figure is only for illustration and is not used to limit the scope of patent protection of this application. According to actual conditions, there can be any number of anchor terminals and audience terminals.

[0037] Embodiment 1 This method embodiment can be executed in a client. In the following, the client is taken as the execution subject of this process.

[0038] Figure 2 The flowchart of the data transmission method according to the first embodiment of the present application is schematically shown.

[0039] like Figure 2 As shown, the data transmission method may include steps S200 to S206, wherein: Step S200: establishing a communication link with a broadcast server.

[0040] Step S202: receiving target service data sent by the broadcast server through the communication link.

[0041] Step S204: When a predetermined rule is triggered, switching from the broadcast server to the cache server.

[0042] Step S206, obtaining the target service data from the cache server; wherein the cache server stores the target service data.

[0043] In the data transmission method provided in this embodiment, the client receives business data from the broadcast server through a communication link. The business data of the broadcast server comes from various business modules in the business server (for example, video connection business, voice chat business, etc.). When the preset rules are triggered, the broadcast server is switched to the cache server that stores the corresponding business data, and the business data is obtained from the cache server. It can be seen that in the embodiment of the present application, when the preset rules are triggered, the client directly obtains the business data from the cache server without having to continuously request the business server, which effectively reduces the cost of the business server and improves the efficiency and reliability of obtaining business data on the client.

[0044] The following combination Figure 2, each step in steps S200~S206 and other optional steps are described in detail.

[0045] Step S200: establishing a communication link with a broadcast server.

[0046] Get the information of the broadcast server, such as the IP address and the port number used for communication. You can select a suitable communication protocol, such as TCP (Transmission Control Protocol), WebSocket, UDP (User Datagram Protocol), etc., according to the requirements of the broadcast server and the characteristics of the network environment. In some embodiments, you can perform corresponding configurations on the client according to the selected communication protocol. For example, set the IP address and port number of the broadcast server, as well as the required buffer size, timeout and other parameters, so that the client can correctly receive the service data sent by the broadcast server.

[0047] Step S202: receiving target service data sent by the broadcast server through the communication link.

[0048] Business data can be text messages (such as system notifications, barrage messages, etc.), traffic data (such as the number of viewers, the maximum number of online users, etc.), interaction data (such as likes, comments, shares, etc.), product data, etc.

[0049] For ease of understanding, combined Figure 1 , the service server sends the target service data to the long chain server, and the long chain server sends the received target service data to the broadcast server. Then, the broadcast server sends the received target service data to the client.

[0050] After the client successfully receives the target service data, an ACK (ACKnowledgment) message can be generated. The ACK message is sent to the designated IP address and port of the long chain server to inform the long chain server that the target service data has been successfully received, thereby reducing the possibility that the long chain server continues to push the same service data to the client. The ACK message can include a unique identifier of the received target service data (such as a sequence number, timestamp, or message ID, etc.) so that the long chain server can verify its validity.

[0051] In an optional embodiment, the broadcast server includes a first broadcast server and a second broadcast server, wherein the first broadcast server is used to store business data of a first priority, corresponding to a first communication link in the communication links; and the second broadcast server is used to store business data of a second priority, corresponding to a second communication link in the communication links.

[0052] like Figure 3 As shown, step S202 may include: Step S300, when the target service data has a first priority, receiving the target service data through the first communication link; Step S302: When the target service data has a second priority, receiving the target service data through the second communication link.

[0053] The first priority business data may be business data that must be delivered to the client as defined by the business party. For example, the first priority business data may be important system information, anchor emergency notifications, key business events, etc.

[0054] The second priority business data can be non-critical business data. For example, non-real-time statistical data updates (such as the number of viewers, the number of likes, etc.), some bullet messages, some gift notifications, and other business data with lower importance. In order to optimize the cost of the client and each server, it is assumed that the client has received the second priority business data.

[0055] In some embodiments, in addition to the first priority and the second priority, more levels of priority can be introduced, such as the third priority (for non-critical but still time-sensitive business data), the fourth priority (for non-real-time and delayed business data), etc., to better meet the needs of different business scenarios.

[0056] In some embodiments, multiple backup communication links may be established between the client and the broadcast server, and these backup links may be automatically switched to the backup communication links when the main communication links fail or become congested.

[0057] In this embodiment, by determining the priority of the target business data, target business data of different priorities are received through different communication links, so that only the target business data of the first priority is subsequently processed to reach the client. For the target business data of the second priority (non-critical business data), it is deemed to have been delivered to the client by default, and there is no need to process it to reach the client later, thereby reducing the cost of each server and client.

[0058] Step S204: When a predetermined rule is triggered, switching from the broadcast server to the cache server.

[0059] The predetermined rule may be that key indicators such as network delay rate, packet loss rate, bandwidth utilization, and the number of requests processed by the broadcast server do not meet (are higher or lower than) a preset threshold.

[0060] In some embodiments, during the process of switching from the broadcast server to the cache server, data can be read from the broadcast server and the cache server at the same time, and then the cache server is completely switched to after the cache server is confirmed to be stable. The advantage of this operation is that data loss or duplication of the client can be reduced during the switching process.

[0061] In an optional embodiment, the cache server is used to store the service data of the first priority. Step S204 may include: When the first communication link is abnormal and the target service data has a first priority, the target service data is acquired from the cache server.

[0062] For example, Figure 1 As shown, when the long chain server determines that the business data is of the first priority, the business data of the first priority is saved to the cache server.

[0063] In this embodiment, when the first communication link is abnormal, the first broadcast server cannot transmit the first priority service data to the client in time. At this time, the long link server will actively inform the client to establish a communication link with the cache server, and obtain the first priority service data from the cache server through the communication link.

[0064] It should be noted that, in some embodiments, the cache server may set a storage time for business data, and if the storage time exceeds a preset time interval (eg, 30 minutes), the business data is deleted, thereby saving storage space of the cache server.

[0065] In this embodiment, the cache server is used as a backup service data source for storing the first priority service data. When an abnormality occurs in the first communication link between the client and the first broadcast server, the corresponding first priority service data can be obtained from the cache server, thereby improving the timeliness, reliability and stability of the service.

[0066] In an optional embodiment, the cache server is used to store the service data of the first priority. Figure 4 As shown, step S204 may include: Step S400, detecting the heartbeat of the first broadcast server; Step S402: when the heartbeat is abnormal and the target service data is of the first priority, obtaining the target service data from the cache server.

[0067] The first broadcast server sends a heartbeat packet to the client periodically (such as every second, every minute, etc.). The heartbeat packet is used to check the connection status and usually contains status information such as the unique identifier of the first broadcast server, the current timestamp, and the sequence number.

[0068] The client can establish a network connection (such as a WebSocket connection, a TCP connection, etc.) to receive a heartbeat packet from the first broadcast server. If the client does not receive a heartbeat packet within a predetermined time interval (i.e., the heartbeat times out), it is determined that the heartbeat of the first broadcast server is abnormal. It can be seen that when the heartbeat of the first broadcast server is abnormal, the client may not be able to receive the first-priority target service data sent by the first broadcast server.

[0069] In the case of heartbeat abnormality and the target business data is the first priority, the client sends a request to the cache server through an appropriate protocol (such as Protobuf protocol). The request sent may include the identifier or query conditions of the target business data to be obtained. The cache server responds to the request sent by the client and returns the corresponding target business data.

[0070] In this embodiment, when the client detects that the heartbeat packet of the first broadcast server is abnormal, the first priority target service data is directly obtained from the cache server, so that the client effectively receives the first priority target service data.

[0071] In an optional embodiment, the cache server is used to store the service data of the first priority. Figure 5 As shown, step S204 may include: Step S500, receiving a push message from the long chain server or the business server, wherein the push message is used to instruct the client to obtain the target business data from the cache server; Step S502: when the target service data is of the first priority, obtaining the target service data from the cache server according to the push message.

[0072] Push messages can be text messages, binary messages, etc. Push messages can be in multiple formats such as JSON, XML, Protobuf, etc.

[0073] The push message may include the address and port of the cache server so that the client can directly connect to the cache server. The push message may also include an identifier of the target service data (e.g., data ID, sequence number, etc.). The identifier of the target service data enables the client to accurately request and obtain the required target service data. The client sends a request to the cache server based on the identifier in the push message to obtain the corresponding target service data.

[0074] In some embodiments, a message queue may be used to temporarily store push messages so as to reduce the rate of message loss when the client is busy or unavailable.

[0075] In some embodiments, the client may specify a valid time range for the push message. For example, if the client receives the push message within the valid time range, the service data is obtained from the cache server. However, if the client receives the push message after the valid time range has expired, the push message may not be processed.

[0076] In this embodiment, the long chain server and the business server push messages to the client, informing it to obtain the first priority business data from the cache server, so as to flexibly respond to various test requirements and improve the timeliness and reliability of business data transmission.

[0077] It can be seen that the timeliness and reliability of business data transmission can be improved through various means such as link communication anomalies, heartbeat anomalies, and back-end notifications.

[0078] Step S206, obtaining the target service data from the cache server; wherein the cache server stores the target service data.

[0079] like Figure 1 As shown, after receiving the business data from the business server, the long chain server will determine the priority of the business data. When the business data is of the first priority, the business data of the first priority will be cached to the cache server.

[0080] like Figure 1 When a predetermined rule is triggered (for example, the first communication link is abnormal, the heartbeat of the first broadcast server is abnormal, the service end actively pushes a message, etc.), the client obtains the first priority service data from the cache server.

[0081] In an optional embodiment, step S206 may include: pulling service data from the cache server in a polling manner until the communication link with the broadcast server returns to normal; wherein the pulled service data includes the target service data.

[0082] You can set polling intervals (such as every second, every half second, etc.), maximum polling times, and other parameters. When the first communication link of the broadcast server returns to normal, the client switches back to the broadcast server and stops polling the cache server.

[0083] After stopping pulling business data from the cache server, the communication link between the client and the cache server can be closed and related resources can be released.

[0084] In this embodiment, data is pulled from the cache server in a polling manner until the first communication link returns to normal, thereby reducing service interruption time and improving user experience.

[0085] Embodiment 2 This method embodiment can be executed in the long chain server in the form of code. The long chain server is taken as the execution subject of this process. It should be noted that the technical details and technical effects of this embodiment can refer to the first embodiment.

[0086] Figure 6 The flowchart of the data transmission method according to the second embodiment of the present application is schematically shown.

[0087] like Figure 6 As shown, the data transmission method may include steps S600 to S606, wherein: Step S600: receiving target service data from a service server.

[0088] Step S602: Determine the priority of the target service data, where the priority includes a first priority and a second priority.

[0089] Step S604: When the target service data is of the first priority, the target service data is sent to a broadcast server and a cache server respectively; The broadcast server is used to forward the target service data to the client; and the cache server is used to forward the target service data to the client when the broadcast server forwards the target service data abnormally.

[0090] The long chain server can pre-define priority rules. Priority rules can be based on factors such as the type, importance, and timeliness of business data. For example, system notifications, emergency messages, etc. may be marked as the first priority, while viewer statistics, non-real-time bullet comments, etc. may be marked as the second priority.

[0091] In some embodiments, the priority can be adjusted dynamically based on real-time business needs and system load. For example, during peak hours, non-critical but time-sensitive data may be temporarily prioritized.

[0092] After receiving the target service data from the service server, the long chain server forwards the target service data to the broadcast server. The broadcast server is responsible for forwarding the target service data to all connected clients. In the case where the target service data is of the first priority, the long chain server sends the target service data to the broadcast server and the cache server at the same time, so that in the case that the broadcast server forwards the first priority service data abnormally (such as delay or failure), the client can obtain the corresponding first priority target service data from the cache server.

[0093] In this embodiment, after receiving the target business data from the business server, the long chain server prioritizes the target business data (first priority and second priority). The first priority data is synchronized to the broadcast server and the cache server. When the broadcast server delays or fails to forward the first priority target business data, the backup first priority target business data can be obtained from the cache server. This embodiment no longer requires each business party to build a polling mechanism to ensure that the client can receive the business data, thereby solving the problem of high business server costs.

[0094] In an optional embodiment, if Figure 7 As shown, the data transmission method may further include: Step S700, obtaining the transmission status of the communication link from the broadcast server to the client; Step S702, when the transmission state of the communication link is abnormal and the target service data is of the first priority, an abnormal message is sent to the client, so that the client obtains the target service data from the cache server in a polling manner according to the abnormal message.

[0095] The exception message may include the error type, measures recommended for the client to take (for example, recommending the client to obtain data from the cache server in a polling manner), the polling interval, etc. The exception message may be in various formats such as JSON and XML.

[0096] When the broadcast server or client receives the service data, it can send the corresponding ACK information to the long chain server within the predetermined time to confirm the successful reception of the service data. If the ACK information is not received within the predetermined time, the transmission state of the communication link is determined to be abnormal. In addition, in the long chain server, when the queue length of various resources (such as memory, buffer, thread pool, etc.) reaches its capacity limit, the long chain server is determined to be in a congested state, and then the transmission state of the communication link is determined to be abnormal.

[0097] In this embodiment, by monitoring the communication link status, when the link is abnormal, the long chain server can actively notify the client to poll the cache server to obtain the first priority data, thereby improving the timeliness and reliability of business data.

[0098] In an optional embodiment, the broadcast server includes a first broadcast server and a second broadcast server. The first broadcast server is used to store service data of a first priority. The second broadcast server is used to store service data of a second priority. Step S700 may include: obtaining a transmission state of a communication link from the first broadcast server to the client to determine whether to send the abnormal message to the client.

[0099] The transmission status of the communication link may include unblocked, blocked, interrupted, packet loss, etc. The communication link may include a first communication link and a second communication link.

[0100] When the long chain server determines that the transmission status of the communication link (ie, the first communication link) from the first broadcast server to the client is abnormal (eg, blocked, interrupted, severe packet loss, etc.), it immediately sends an abnormal message to the client.

[0101] In an optional embodiment, the data transmission method may further include: In a case where the target service data is of the second priority level, the target service data is sent to a second broadcast server.

[0102] When the long chain server determines that the target business data is second-priority business data such as viewer statistics and non-real-time barrage, it sends it to the second broadcast server so that the client can receive the second-priority business data through the communication link from the second broadcast server to the client (i.e., the second communication link).

[0103] Embodiment 3 This method embodiment can be executed on a business server. The business server is taken as the execution subject of this process. It should be noted that the technical details and technical effects of this embodiment can refer to the first embodiment and the second embodiment.

[0104] Figure 8 The flowchart of the data transmission method according to the third embodiment of the present application is schematically shown.

[0105] like Figure 8 As shown, the data transmission method may include steps S800 to S802, wherein: Step S800, obtaining the protocol of the target business data.

[0106] Step S802: When the target service data is not of the target protocol, encapsulate the target service data to obtain the target service data of the target protocol.

[0107] Step S804, transmitting the target data of the target protocol to the broadcast server or to the broadcast server and the cache server through the long link server, so that the broadcast server or the cache server forwards the business data of the target protocol to the client; wherein, when the cache server or the broadcast server forwards the business data of the target protocol abnormally, it forwards the business data of the target protocol to the client.

[0108] The target business data can be various protocols such as JSON and XML. The target protocol can be the Protobuf protocol.

[0109] When the business server determines that the target business data is not in Protobuf protocol, it encapsulates the target business data based on Protobuf protocol. Compared with JSON and XML protocols, Protobuf protocol has higher data compression efficiency and simpler development process, which can effectively reduce the bandwidth required for business data transmission. In addition, Protobuf protocol allows backward compatibility and forward compatibility. New fields can be safely added to existing protocols without affecting old versions.

[0110] The client receives the target service data of the target protocol and parses it to obtain valid service data.

[0111] In this embodiment, the bandwidth required for business data transmission is effectively reduced by encapsulating business data of other protocols (such as JSON protocol) into business data of the target protocol (such as Protobuf protocol).

[0112] In order to make this application easier to understand, the following Figure 1 and Fig. 9 An exemplary application is provided.

[0113] Step S900: The business server encapsulates the target business data based on the Protobuf protocol.

[0114] Step S902: The business server sends the encapsulated target business data to the long chain server.

[0115] Step S904, after receiving the target business data, the long chain server determines the priority of the received target business data. The priority includes the first priority and the second priority. The business data of the first priority is the business data that must be delivered to the client as defined by the business party. The business data of the second priority is delivered to the client by default, and no related processing is required to reach the client.

[0116] Step S906: The long chain server sends the target service data of the first priority to the first broadcast server and the cache server at the same time, and sends the target service data of the second priority to the second broadcast server.

[0117] Step S908: The first broadcast server sends the received target service data of the first priority to the client via the first communication link. The second broadcast server sends the received target service data of the second priority to the client via the second communication link.

[0118] Step S910: When the client does not receive a heartbeat packet from the first broadcast server within a preset time interval, the client obtains target service data of the first priority from the cache server; or When the long chain server is blocked, an exception message is sent to the client to inform the client to obtain the first priority target service data from the cache server; or The business server or long chain server actively pushes a message to the client to inform the client to obtain the first priority target business data from the cache server.

[0119] Step S912: After receiving the target service data of the first priority, the client sends ACK information to the long chain server to confirm the successful reception of the target service data.

[0120] Embodiment 4 Fig.10 The block diagram of the data transmission device according to the fourth embodiment of the present application is schematically shown. The device is applied to the client. The device can be divided into one or more program modules. One or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig.10 As shown, the apparatus 1000 may include: an establishing module 1100, a receiving module 1200, and an acquiring module 1300, wherein: Establishing module 1100, used to establish a communication link with a broadcast server; The receiving module 1200 is used to receive the target service data sent by the broadcast server through the communication link; A switching module 1300, configured to switch from the broadcast server to the cache server when a predetermined rule is triggered; The acquisition module 1400 is used to acquire the target business data from the cache server; wherein the cache server stores the target business data.

[0121] In an optional embodiment, the broadcast server includes a first broadcast server and a second broadcast server. The first broadcast server is used to store service data of a first priority, corresponding to a first communication link among the communication links; The second broadcast server is used to store service data of a second priority, corresponding to a second communication link in the communication links; Wherein, receiving the target service data sent by the broadcast server through the communication link includes: When the target service data has a first priority, receiving the target service data through the first communication link; In a case where the target service data has a second priority, the target service data is received through the second communication link.

[0122] In an optional embodiment, the cache server is used to store business data of the first priority; When a predetermined rule is triggered, obtaining the target service data from the cache server includes: When the first communication link is abnormal and the target service data has a first priority, the target service data is acquired from the cache server.

[0123] In an optional embodiment, the cache server is used to store business data of the first priority; When a predetermined rule is triggered, obtaining the target service data from the cache server includes: Detecting the heartbeat of the first broadcast server; When the heartbeat is abnormal and the target service data is of the first priority, the target service data is obtained from the cache server.

[0124] In an optional embodiment, the cache server is used to store business data of the first priority; When a predetermined rule is triggered, obtaining the target service data from the cache server includes: Receiving a push message from the long chain server or the service server, wherein the push message is used to instruct the client to obtain the target service data from the cache server; In a case where the target service data is of the first priority, the target service data is acquired from the cache server according to the push message.

[0125] In an optional embodiment, obtaining the target service data from the cache server includes: Pulling service data from the cache server in a polling manner until the communication link with the broadcast server returns to normal; The pulled business data includes the target business data.

[0126] Embodiment 5 Fig.11 The block diagram of the data transmission device according to the fifth embodiment of the present application is schematically shown. The device is used for a long chain server. The device can be divided into one or more program modules. One or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig.11As shown, the apparatus 2000 may include: a receiving module 2100, a determining module 2200, and a sending module 2300, wherein: The receiving module 2100 is used to receive target service data from the service server; A determination module 2200, configured to determine a priority of the target service data, wherein the priority includes a first priority and a second priority; A sending module 2300, configured to send the target service data to a broadcast server and a cache server respectively when the target service data is of the first priority; Wherein, the broadcast server is used to forward the target service data to the client; The cache server is used for forwarding the target service data to the client when the broadcast server forwards the target service data abnormally.

[0127] In an optional embodiment, the data transmission device further includes: Acquire a transmission status of a communication link from the broadcast server to the client; When the transmission state of the communication link is abnormal and the target service data is of the first priority, an abnormal message is sent to the client, so that the client obtains the target service data from the cache server in a polling manner according to the abnormal message.

[0128] In an optional embodiment, the broadcast server includes a first broadcast server and a second broadcast server. The first broadcast server is used to store service data of the first priority. The second broadcast server is used to store the service data of the second priority. Wherein, obtaining the transmission status of the communication link from the broadcast server to the client includes: The transmission status of the communication link from the first broadcast server to the client is obtained to determine whether to send the abnormal message to the client.

[0129] In an optional embodiment, the data transmission device further includes: In a case where the target service data is of the second priority level, the target service data is sent to a second broadcast server.

[0130] Embodiment 6 Fig.12The block diagram of the data transmission device according to the sixth embodiment of the present application is schematically shown. The device is used for a business server. The device can be divided into one or more program modules. One or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig.12 As shown, the device 3000 may include: an acquisition module 3100, a packaging module 3200, and a transmission module 3300, wherein: An acquisition module 3100 is used to acquire a protocol of target business data; The encapsulation module 3200 encapsulates the target service data to obtain the target service data of the target protocol when the target service data is not of the target protocol; The transmission module 3300 is used to transmit the target data of the target protocol to the broadcast server or to the broadcast server and the cache server through the long link server, so that the broadcast server or the cache server forwards the business data of the target protocol to the client; wherein, when the cache server or the broadcast server forwards the business data of the target protocol abnormally, it forwards the business data of the target protocol to the client.

[0131] Embodiment 7 Fig.13 The hardware architecture diagram of a computer device 10000 suitable for implementing a data transmission method according to Embodiment 7 of the present application is schematically shown. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle-mounted terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig.13 As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them: The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10010 can be an internal storage module of the computer device 10000, such as a hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 can also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 can also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store an operating system and various application software installed in the computer device 10000, such as program codes of a data transmission method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or are to be output.

[0132] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.

[0133] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.

[0134] It should be pointed out that Fig.13 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0135] In this embodiment, the data transmission method stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.

[0136] Embodiment 8 An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the data transmission method in the embodiment are implemented.

[0137] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the computer-readable storage medium can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on the computer device, such as the program code of the data transmission method in the embodiment. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or are to be output.

[0138] Embodiment 9 An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.

[0139] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0140] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A data transmission method, characterized in that: For a client, the method comprises: Establishing a communication link with a broadcast server; receiving target service data sent by the broadcast server through the communication link; When a predetermined rule is triggered, switching from the broadcast server to the cache server; The target business data is obtained from the cache server; wherein the cache server stores the target business data.

2. The method according to claim 1, characterized in that The broadcast server includes a first broadcast server and a second broadcast server. The first broadcast server is used to store service data of a first priority, corresponding to a first communication link among the communication links; The second broadcast server is used to store service data of a second priority, corresponding to a second communication link in the communication links; Wherein, receiving the target service data sent by the broadcast server through the communication link includes: When the target service data has a first priority, receiving the target service data through the first communication link; In a case where the target service data has a second priority, the target service data is received through the second communication link.

3. The method according to claim 2, characterized in that The cache server is used to store the service data of the first priority; When a predetermined rule is triggered, obtaining the target service data from the cache server includes: When the first communication link is abnormal and the target service data has a first priority, the target service data is acquired from the cache server.

4. The method according to claim 2, characterized in that: The cache server is used to store the service data of the first priority; When a predetermined rule is triggered, obtaining the target service data from the cache server includes: Detecting the heartbeat of the first broadcast server; When the heartbeat is abnormal and the target service data is of the first priority, the target service data is obtained from the cache server.

5. The method according to claim 2, characterized in that: The cache server is used to store the service data of the first priority; When a predetermined rule is triggered, obtaining the target service data from the cache server includes: Receiving a push message from the long chain server or the service server, wherein the push message is used to instruct the client to obtain the target service data from the cache server; In a case where the target service data is of the first priority, the target service data is acquired from the cache server according to the push message.

6. The method according to claim 1, characterized in that Acquiring the target service data from the cache server includes: Pulling service data from the cache server in a polling manner until the communication link with the broadcast server returns to normal; The pulled business data includes the target business data.

7. A data transmission method, characterized in that: For a long chain server, the method comprises: Receiving target business data from a business server; Determining a priority of the target service data, the priority including a first priority and a second priority; When the target service data is of the first priority, sending the target service data to a broadcast server and a cache server respectively; Wherein, the broadcast server is used to forward the target service data to the client; The cache server is used for forwarding the target service data to the client when the broadcast server forwards the target service data abnormally.

8. The method according to claim 7, characterized in that The method further comprises: Acquire a transmission status of a communication link from the broadcast server to the client; When the transmission state of the communication link is abnormal and the target service data is of the first priority, an abnormal message is sent to the client so that the client obtains the target service data from the cache server in a polling manner according to the abnormal message.

9. The method according to claim 8, characterized in that The broadcast server includes a first broadcast server and a second broadcast server. The first broadcast server is used to store service data of the first priority. The second broadcast server is used to store the service data of the second priority. Wherein, obtaining the transmission status of the communication link from the broadcast server to the client includes: The transmission status of the communication link from the first broadcast server to the client is obtained to determine whether to send the abnormal message to the client.

10. The method according to claim 9, characterized in that The method further comprises: In a case where the target service data is of the second priority level, the target service data is sent to a second broadcast server.

11. A data transmission method, characterized in that: For a business server, the method comprises: Protocol for obtaining target business data; In the case where the target service data is not of the target protocol, encapsulating the target service data to obtain the target service data of the target protocol; The target data of the target protocol is transmitted to the broadcast server or to the broadcast server and the cache server through the long chain server, so that the broadcast server or the cache server forwards the business data of the target protocol to the client; wherein, when the cache server or the broadcast server forwards the business data of the target protocol abnormally, the business data of the target protocol is forwarded to the client.

12. A data transmission device, characterized in that: For a client, the device comprises: An establishing module, used for establishing a communication link with a broadcast server; A receiving module, used for receiving target service data sent by the broadcast server through the communication link; A switching module, configured to switch from the broadcast server to the cache server when a predetermined rule is triggered; The acquisition module is used to acquire the target business data from the cache server; wherein the cache server stores the target business data.

13. A data transmission device, characterized in that: For a long chain server, the device comprises: A receiving module, used for receiving target business data from a business server; A determination module, used to determine the priority of the target service data, wherein the priority includes a first priority and a second priority; A sending module, configured to send the target service data to a broadcast server and a cache server respectively when the target service data has the first priority; Wherein, the broadcast server is used to forward the target service data to the client; The cache server is used for forwarding the target service data to the client when the broadcast server forwards the target service data abnormally.

14. A data transmission device, characterized in that: Used for a business server, the device comprises: Acquisition module, protocol for acquiring target business data; an encapsulation module, which encapsulates the target service data to obtain target service data of the target protocol when the target service data is not of the target protocol; A transmission module is used to transmit the target data of the target protocol to the broadcast server or to the broadcast server and the cache server through the long link server, so that the broadcast server or the cache server forwards the business data of the target protocol to the client; wherein, when the cache server or the broadcast server forwards the business data of the target protocol abnormally, the business data of the target protocol is forwarded to the client.

15. A computer device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 11.

16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 11 is implemented.

17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to claims 1 to 11 are implemented.