WO2012159287A1 - Method and device for data transmission - Google Patents

Method and device for data transmission Download PDF

Info

Publication number
WO2012159287A1
WO2012159287A1 PCT/CN2011/076176 CN2011076176W WO2012159287A1 WO 2012159287 A1 WO2012159287 A1 WO 2012159287A1 CN 2011076176 W CN2011076176 W CN 2011076176W WO 2012159287 A1 WO2012159287 A1 WO 2012159287A1
Authority
WO
WIPO (PCT)
Prior art keywords
client device
server
proxy device
optimized connection
connection
Prior art date
Application number
PCT/CN2011/076176
Other languages
French (fr)
Chinese (zh)
Inventor
黄一宏
吴钦
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2011/076176 priority Critical patent/WO2012159287A1/en
Priority to CN201180000950.9A priority patent/CN102439946B/en
Publication of WO2012159287A1 publication Critical patent/WO2012159287A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a data transmission method and device.
  • HTTP streaming hypertext transfer protocol
  • HTTP Hyper Text Transfer Protocol
  • HTTP is a unicast protocol.
  • the server may need to provide services for a large number of users, which will inevitably put a lot of pressure on the performance of the server and network bandwidth.
  • proxy caching To alleviate the pressure on concurrent servers from concurrent users, it is common to add agents between servers and users, and use proxy caching to ease server stress.
  • the proxy caches the accessed data first and then sends it to the requesting user.
  • the proxy can directly send the cached data to the user without re-acquiring from the server. Data, which reduces the bandwidth pressure from the agent to the server.
  • the embodiment of the invention provides a data transmission method and device, which can reduce the pressure on the server caused by concurrent users in the live broadcast scenario.
  • a data transmission method includes:
  • the server obtains an embedded protocol supported by the client device
  • the server specifies a proxy device, and establishes an optimized connection connected to the proxy device by using an embedded protocol supported by the client device;
  • the server generates response data based on the embedded protocol, and sends the response data to the proxy device through the optimized connection, so that the proxy device encapsulates the response data by using a hypertext transfer protocol. Sent to the client device.
  • a data transmission method includes:
  • the proxy device forwards the received data request sent by the client device to the server;
  • the proxy device sends the response data to the client device by using a hypertext transfer protocol.
  • a server comprising:
  • An obtaining module configured to obtain an embedded protocol supported by the client device
  • connection establishing module configured to specify a proxy device, and establish an optimized connection connected to the proxy device by using an embedded protocol supported by the client device;
  • a receiving module configured to receive, by the proxy device, a data request from the client device
  • a response module configured to generate response data based on the embedded protocol, and send the response data to the proxy device by using the optimized connection, so that the proxy device performs the outer layer of the response data by using a hypertext transfer protocol After being encapsulated, it is sent to the client device.
  • An agent device including:
  • a request forwarding module configured to forward the data request sent by the received client device to the server;
  • the data receiving module is configured to receive response data sent by the server through the established optimized connection, where the optimized connection is the proxy
  • the device and the server are established by using an embedded protocol supported by the client device, and the response data is response data based on the embedded protocol;
  • a data sending module configured to send the response data to the client device by using a hypertext transfer protocol.
  • the server can change the designated proxy device when the designated proxy device fails; on the other hand, establishes between the server and the proxy device Optimized connections with better transmission efficiency than HTTP connections can transmit data, which can alleviate the pressure on the server, especially the concurrent users requesting pressure on the server in the live broadcast scenario.
  • FIG. 1 is a flowchart of a data transmission method according to an embodiment of the present invention.
  • FIG. 2 is a flowchart of a data transmission method according to another embodiment of the present invention.
  • FIG. 4 is a schematic diagram of a server according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a proxy device according to an embodiment of the present invention.
  • a proxy device is placed between the server and the client device to take advantage of the proxy device's caching capabilities to ease server stress.
  • the proxy device is generally pre-configured, and the client device requests data from the server through the proxy device by default. However, once the proxy device fails, the connection between the client and the server is interrupted, and the data request sent by the client device cannot reach the server or receive the response data sent by the server.
  • a unicast protocol HTTP is usually used to establish an HTTP connection and transfer data, and the client device receives the HTTP.
  • Layer encapsulated data the data transfer efficiency of the HTTP connection is low, which will cause the server to be under pressure.
  • an embodiment of the present invention provides a data transmission method.
  • a server designates a proxy device, and a client device requests data from a server through a proxy device specified by the server.
  • a proxy device specified by the server.
  • between the server and the proxy device Establish a connection with better transmission efficiency than HTTP connection for data transmission.
  • the connection that has better transmission efficiency than the HTTP connection is referred to herein as an optimized connection, and the optimized connection may be a WebSocket connection or a multicast connection.
  • the server can further specify other proxy devices, and the client can perform data interaction with the server through other proxy devices to obtain the requested data; on the other hand, optimize the connection such as a WebSocket connection or Multicast connections have higher data transfer efficiency than HTTP connections, which can alleviate server stress.
  • Embodiments of the present invention also provide corresponding devices and systems. The following is a detailed description.
  • an embodiment of the present invention provides a data transmission method, including: 110.
  • the server obtains an embedded protocol supported by the client device.
  • an embedded protocol supported by the client device is used between the server and the proxy device, and the embedded protocol supported by the client device is used to establish an optimized connection for data transmission.
  • the embedded protocol may be a WebSocket protocol or a multicast protocol.
  • the data sent by the server received by the proxy device will be the data encapsulated by the embedded protocol.
  • the proxy device needs to use the HTTP protocol to encapsulate the received data before sending it to the client device through the HTTP connection.
  • the data received by the client device will be double-encapsulated with the embedded protocol as the inner layer encapsulation protocol and the HTTP protocol as the outer encapsulation protocol. This requires the client device to have the ability to parse data encapsulated in a two-tier protocol.
  • This capability of the client device is referred to as the tunneling capability of the client device.
  • the tunnel capability of the client device can be obtained, so as to establish an optimized connection with the proxy device by using an embedded protocol supported by the client.
  • the client device may send a tunnel negotiation request to the server before sending the data request to the server, and the tunneling capability of the client device is carried in the tunnel negotiation request to notify the server.
  • the tunnel negotiation request includes: an identifier of the embedded protocol supported by the client device, and a data content requested by the client device, for example, an identifier of the program requested to be viewed; and the identifier of the client device.
  • the identifier of the program requested by the client device may be any information such as a channel number or a frequency (frequency) that can identify the program requested to be viewed.
  • the identifier of the embedded protocol may be any name that identifies the embedded protocol, such as the name, code, or ID (IDentity) of the embedded protocol.
  • the embedded protocol may be a WebSocket protocol or a multicast protocol, and the multicast protocol may be a Real Time Streaming Protocol (RTSP) or a Real-Time Transport Protocol (RTP).
  • RTSP Real Time Streaming Protocol
  • RTP Real-Time Transport Protocol
  • the identity of the client device is any information that can identify the client, such as the Internet Protocol (IP) address of the client.
  • IP Internet Protocol
  • the server identifies the tunnel capability of the client device by receiving a tunnel negotiation request sent by the client device. If the client device supports two or more embedding protocols, the server may select one of them as a protocol for subsequent establishment of an optimized connection with the proxy device. If there is only one type of embedding protocol supported by the client device, the server directly selects the embedding protocol as a protocol for subsequent establishment of an optimized connection with the proxy device. If the server does not recognize the tunneling capability of the client device, ie, it does not recognize the identity of the embedded protocol supported by the client device, it can respond to the error response. Client device.
  • the server specifies a proxy device, and uses an embedded protocol supported by the client device to establish an optimized connection that is connected to the specified proxy device.
  • the server can specify an agent device from the currently available proxy devices according to the policy to establish an optimized connection with the specified proxy device.
  • the said policy may be: comparing the burden of each available proxy device, specifying a proxy device with less burden, such as comparing the number of client devices connected to each proxy device, and specifying a proxy device in which fewer client devices are connected It is also possible to compare the distance of the proxy device relative to the server, such as a hop count, a difference from a standard value, specify the proxy device with the smallest difference; or compare the indices of the available proxy devices.
  • the index is weighted according to the burden of the proxy device and the distance from the server, specifying the proxy device with the largest or smallest index.
  • the server After the server specifies the proxy device, it sends a tunnel designation message to the specified proxy device.
  • the tunnel specifies the identifier of the embedded protocol supported by the client device. If the server selects one of the embedded protocols supported by the client device, the tunnel designation message includes only the identity of the selected embedded protocol.
  • the tunnel designation message may further include an identifier of a program requested by the client device to view.
  • the tunnel designation message may also include an identifier of the client device, such as an IP address of the client device, and the IP address of the client device may be obtained from the tunnel negotiation request.
  • the proxy device supports at least one of the embedded protocol in the tunnel designation message, the embedded protocol embedded protocol and the supported embedded protocol embedding protocol are used to establish an optimized connection with the server, if the tunnel designation message is present and the embedded protocol it supports If there is more than one, choose one of the embedded protocols to establish an optimized connection with the server.
  • the optimized connection can be: a WebSocket connection, or an RTSP connection, or an RTP connection.
  • the proxy device can send a tunnel specifying a successful response to the server to indicate that the optimized connection has been established successfully.
  • the server After the optimized connection establishment is completed, the server establishes and saves a first correspondence between the identifier of the optimized connection and the identifier of the program requested by the client device to view. If the first correspondence exists, the first correspondence is updated according to the identifier of the optimized connection and the identifier of the program requested by the client device, that is, if the identifier of the optimized connection corresponds to the identifier of the program requested by the client device If the relationship is not in the first correspondence, it is added to the first correspondence.
  • the first correspondence may be saved in the form of a correspondence table, which is referred to as a first correspondence table, as shown in Table 1, wherein a digital number such as 101 may be used as an identifier for optimizing the connection, and a channel number such as a central set may be used.
  • a digital number such as 101
  • a channel number such as a central set
  • the identifier of the program requested to be viewed by the client device may also be the frequency 57.75 MHz corresponding to the frequency of the CCTV 1 as the identifier of the program to be viewed.
  • the proxy device may also establish and save the identifier of the optimized connection and request the viewing by the client device.
  • the correspondence between the identifiers of the programs is called the second correspondence, and may also be the form of the correspondence table, as shown in FIG. 1 . If the second correspondence exists, the second correspondence is updated according to the identifier of the optimized connection and the identifier of the program requested by the client device included in the tunnel designation message, that is, if the identifier of the optimized connection and the client device request to view The correspondence of the identifiers of the programs is not in the second correspondence, and is added to the second correspondence.
  • the optimized connection between the proxy device and the server has a one-to-one correspondence with the program requested by the client device.
  • the server may query whether the optimized connection of the program already exists in the saved first correspondence, and if it does not exist, indicating that the optimized connection of the program has not been established, the server and the proxy device are Establishing an optimized connection for the program; if an optimized connection to the program already exists, the server and the proxy device may no longer establish a new optimized connection, but instead employ an established optimized connection of the program.
  • the server may also not carry out the query, but the identifier of the program is carried in the tunnel designation message and sent to the proxy device, and the proxy device queries whether the optimized connection of the program already exists in the saved second correspondence, if not, the proxy device An optimized connection to the program is established with the server; if it already exists, the proxy device and the server can no longer establish a new optimized connection, but instead utilize the established optimized connection of the program.
  • one program may correspond to more than one optimized connection.
  • the program CCTV 6 corresponds to two optimized connections 103 and 104.
  • each optimized connection can only correspond to one program.
  • the server or proxy device may also store the identity of the client device, such as an IP address, in its first or second correspondence, as shown in Table 2.
  • the IP address of the client device can be obtained from the tunnel negotiation request, for example, from the source address field of the tunnel negotiation request. In this way, it is also possible to determine whether the burden of optimizing the connection is too heavy, as described above, and determine whether the number of client devices corresponding to the optimized connection reaches a threshold.
  • the proxy device specified by the server does not support the embedded protocol selected by the server, the proxy device sends an error response to the server.
  • the server can re-designate a new proxy device to establish an optimized connection with the new proxy device.
  • the server can also reject the client's tunnel negotiation request, that is, send a tunnel negotiation failure message to the client. device.
  • the server After the server successfully establishes an optimized connection with the specified proxy device, the server sends the identifier of the specified proxy device to the client device to instruct the client device to send a data request for requesting program data to the designated proxy device. Data is requested from the server through the proxy device.
  • the server can also send the identity of the optimized connection to the client device.
  • the server may send the identifier of the specified proxy device to the client device in a tunnel negotiation success response. After the client device receives the identity of the proxy device, it can send a data request to the proxy device to request program data.
  • the server receives, by the proxy device, a data request from the client device, and generates response data based on the embedded protocol, and sends the response data to the proxy device by using the optimized connection.
  • the proxy device uses the HTTP protocol to externally encapsulate the response data and then sends the response data to the client device.
  • the data request is an HTTP request
  • the proxy device establishes an HTTP connection with the client device based on the data request.
  • the client device After the client device obtains the identity of the proxy device sent by the server, it can send a data request for requesting program data to the proxy device.
  • the data request includes an identifier of a program requested by the client device and an identifier of the client.
  • the server sends the identifier of the optimized connection to the client device
  • the data request may also include the identifier of the optimized connection and the identifier of the client, or the identifier of the program requested by the client device, the identifier of the optimized connection, and the client. The identity of the end.
  • a third correspondence is established on the proxy device.
  • the third correspondence may also be saved in the form of a correspondence table, which is referred to as a third correspondence table, as shown in Table 3.
  • the third correspondence corresponds to at least the correspondence between the identifier of the optimized connection and the identifier of the client device.
  • the proxy device can establish a third correspondence according to the tunnel designation message or the data request. For example, if the identifier of the client device is included in the tunnel designation message, after receiving the tunnel designation message sent by the server, the proxy device establishes or utilizes the identifier of the client device according to the tunnel designation message according to the tunnel designation message.
  • the identifier of the optimized connection establishes a third correspondence.
  • the proxy device After receiving the data request, the proxy device establishes a third correspondence according to the identifier of the client device in the data request and the identifier of the optimized connection. If the third correspondence is already existing, the third correspondence is updated according to the identifier of the optimized connection and the identifier of the client device, that is, if the correspondence between the identifier of the optimized connection and the identifier of the client device is not in the third correspondence, Then add it to the third correspondence.
  • the third correspondence may also include an identifier of the program, which is saved in the form of a third correspondence table.
  • the third correspondence is shown in Table 4.
  • the proxy device may establish a third correspondence according to the tunnel designation message or the data request, or establish a third correspondence including the identifier of the program according to the tunnel designation message and the data request. For example, if the tunnel designation message includes the identifier of the program requested by the client device and the identifier of the client device, after receiving the tunnel designation message sent by the server, the proxy device requests the client device according to the tunnel designation message.
  • the identifier of the program being watched, the identifier of the client device, and the identifier of the optimized connection established or utilized according to the tunnel designation message establish a third correspondence.
  • the proxy device after receiving the data request, the proxy device optimizes the connection according to the identifier of the program in the data request.
  • the identifier of the client establishes a third correspondence with the identifier of the client.
  • the proxy device may obtain the correspondence between the identifier of the program and the identifier of the optimized connection from the tunnel designation message, obtain the correspondence between the identifier of the program and the identifier of the client device from the data request, or optimize the identifier of the connection and the identifier of the client device. Correspondence relationship, thereby establishing a third correspondence.
  • the corresponding relationship between the identifier of the client device and the identifier of the optimized connection may be obtained from the tunnel designation message, and the correspondence between the identifier of the program and the identifier of the client device is obtained from the data request, thereby establishing a third correspondence. If the second correspondence and the third correspondence are both established according to the tunnel designation message, the content of the second correspondence and the third correspondence may be the same, or may be the same correspondence.
  • the proxy device may directly forward the data request to the server. If the proxy device has the aggregation function, the second data request sent by the multiple client devices may be aggregated into one first data. The request is sent to the server.
  • the aggregation function may be a multiplexing function defined by a real-time streaming protocol, and may specifically be to package multiple second data requests for requesting different programs into one first data request, or to view multiple requests.
  • the second data request of the same program is suppressed into a first data request. The suppression means that only one is retained. The second data request ignores other requests for the second data to view the same program, and the reserved second data request is used as the first data request.
  • the server generates response data of the program according to the identifier of the program included in the received data request, and obtains an optimized connection corresponding to the program according to the first correspondence, and sends the response data of the program to the proxy through the optimized connection corresponding to the program. device. If the data request received by the server includes the identifiers of the plurality of programs, the server generates multiple response data, that is, generates one response data for each program; then the server queries the first correspondence to obtain an optimized connection for each program, and Response data for different programs is sent to the proxy device via their respective optimized connections.
  • the proxy device After receiving the response data sent by the server through the optimized connection, the proxy device needs to use the HTTP protocol to encapsulate the response data before sending the encapsulated response data to the client device through the HTTP connection. Specifically, after receiving the response data sent by the server through the optimized connection, for example, the proxy device, the proxy device performs external encapsulation on the response data by using the HTTP protocol, and then queries the third corresponding relationship to obtain the client device corresponding to the optimized connection 101. The identifier, the encapsulated response data is sent to the client device obtained by the query; if the query is that the corresponding client device has multiple, the encapsulated response data is copied into the number according to the corresponding client device. The copies are sent to the corresponding multiple client devices.
  • the data received by the client device will be double-encapsulated with the embedded protocol as the inner layer encapsulation protocol and the HTTP protocol as the outer encapsulation protocol.
  • the inner embedding protocol is an embedded protocol supported by the client. Thus, the client device can parse the received data and watch the program normally.
  • the proxy device is specified by the server, and when the designated proxy device fails, the server can change the designated proxy device, and establish an optimized connection with the changed proxy device.
  • the client performs data interaction, so as to ensure that the data transmission between the client and the server is not interrupted; on the other hand, an optimized connection is established between the server and the proxy device by using an embedded protocol supported by the client, and the optimized connection is transmitted through the connection.
  • the data request sent by the client device through the proxy device and the response data returned by the server may have better transmission efficiency than the HTTP connection transmission data in the prior art, thereby reducing the pressure on the server, especially in the live broadcast scenario. User requests pressure on the server.
  • the proxy device has an aggregation function, by aggregating multiple data requests into one, the traffic bandwidth between the proxy device and the server can be further reduced, resources are saved, and the burden on the server is reduced. The steps to connect.
  • the client device may send a disconnect request to the proxy device to inform the proxy device that the program has stopped watching, the disconnect request includes an identifier of the program that the client device stops watching, and the client device Logo.
  • the client device can also notify the proxy device not to send a disconnect request when stopping watching the program, and the proxy device needs to use a preset mechanism, such as a timeout mechanism, to sense whether the client device has stopped watching the program.
  • a preset mechanism such as a timeout mechanism
  • the proxy device may also know the server after updating the second correspondence saved by the server, so that the server updates the first correspondence saved by itself, and stops watching the program. The identity of the client device is removed from the first correspondence.
  • the optimized connection may be removed.
  • the operation of tearing down the connection can be initiated by the proxy device. If the first correspondence established by the server holds the client identifier, the operation of tearing down the connection may also be initiated by the server.
  • an embodiment of the present invention provides a data transmission method, including:
  • the proxy device forwards the received data request sent by the client device to the server.
  • the proxy device and the server have established an optimized connection in advance, and the optimized connection is established by using an embedded protocol supported by the client device, and the embedded protocol is a protocol with better transmission efficiency than HTTP, and specifically may be a WebSocket protocol or Multicast protocol.
  • the steps for the proxy device and the server to establish an optimized connection may include:
  • the proxy device receives the tunnel designation message sent by the server, where the tunnel designation message carries the embedded protocol supported by the client device and the identifier of the program requested by the client device.
  • the proxy device can send a tunnel specifying a successful response to the server to indicate that the optimized connection has been established successfully.
  • the proxy device may establish and save a second correspondence, where the second correspondence includes at least: a correspondence between the program requested by the client device and the optimized connection.
  • the second correspondence is updated according to the identifier of the optimized connection and the identifier of the program requested by the client device included in the tunnel designation message, that is, if the identifier of the optimized connection and the client device request to view
  • the correspondence of the identifiers of the programs is not in the second correspondence, and is added to the second correspondence.
  • the second correspondence may specifically be in the form of a correspondence table, as shown in FIG. 1 .
  • the proxy device may query whether the optimized connection of the program already exists in the second correspondence relationship before establishing the optimized connection with the server. If not, it indicates that the optimized connection of the program has not been established yet, and the proxy device and the proxy device The server establishes an optimized connection for the program. If the query finds that an optimized connection for the program already exists, the proxy device and the server may no longer establish a new optimized connection, but instead utilize the established optimized connection of the program.
  • the server sends the identifier of the proxy device to the client device to instruct the client device to send a data request for requesting program data to the designated proxy device.
  • the proxy device may directly forward the data request to the server.
  • the proxy device has the aggregation function, the second data request sent by the multiple client devices may be aggregated into one first data.
  • the request is sent to the server.
  • the aggregation function may be a multiplexing function defined by a real-time streaming protocol, and may specifically be to package multiple second data requests for requesting different programs into one first data request, or to view multiple requests.
  • the second data request of the same program is suppressed into a first data request.
  • the suppression means that only one second data request is reserved, and other second data requests for viewing the same program are ignored, and the retained second data request is used as the first data request.
  • the third correspondence may also be established and saved.
  • the third correspondence may also be saved in the form of a correspondence table, which is referred to as a third correspondence table, as shown in Table 3.
  • the third correspondence corresponds to at least the correspondence between the identifier of the optimized connection and the identifier of the client device. If the third correspondence exists, the third correspondence is updated according to the identifier of the optimized connection and the identifier of the client device, that is, if the identifier of the optimized connection and the identifier of the client device are If the relationship is not in the third correspondence, it is added to the third correspondence.
  • the proxy device receives response data sent by the server through an established optimized connection, where the optimized connection is established by the proxy device and the server using an embedded protocol supported by the client device, and the response is The data is based on the response data of the embedded protocol.
  • the proxy device receives the response data sent by the server.
  • the response data is generated by the server based on the identification of the program included in the data request, and a response data is generated for each program.
  • the server After the server generates the response data, the optimized connection of each program is obtained by querying the first correspondence, and the response data of the different programs is sent to the proxy device through the corresponding optimized connection.
  • the optimized connection is established by the proxy device and the server using an embedded protocol supported by the client device.
  • the response data is based on response data of the embedded protocol, i.e., response data using the embedded protocol.
  • the proxy device performs outer layer encapsulation on the response data by using a hypertext transfer protocol, and sends the response data to the client device.
  • the proxy device After receiving the response data sent by the server through the optimized connection, the proxy device needs to use the HTTP protocol to encapsulate the response data before sending the encapsulated response data to the client device through the HTTP connection. Specifically, after receiving the response data sent by the server through the optimized connection, the proxy device may query the client device corresponding to the optimized connection from the saved third correspondence, and send the response data of the outer package by using HTTP. Queryed client device.
  • the data received by the client device will be double-encapsulated with the embedded protocol as the inner layer encapsulation protocol and the HTTP protocol as the outer encapsulation protocol.
  • the inner embedding protocol is an embedded protocol supported by the client. Thus, the client device can parse the received data and watch the program normally.
  • the data transmission method provided by the example of the present invention establishes an optimized connection between the server and the proxy device by using an embedded protocol supported by the client, and transmits the data request sent by the client device through the proxy device and the server returns through the optimized connection.
  • the response data can transmit data with respect to the HTTP connection in the prior art, and can have better transmission efficiency, thereby reducing the pressure on the server, especially the concurrent user requesting pressure on the server in the live broadcast scenario.
  • the proxy device has an aggregation function, by aggregating multiple data requests into one, the traffic bandwidth between the proxy device and the server can be further reduced, resources are saved, and the burden on the server is reduced.
  • the device involved includes three client devices 301, 302, and 303, a proxy device 304 without tunnel function, and a proxy device 305 having a tunnel encapsulation function.
  • Client devices 301, 302, and 303 support the same embedding protocol, such as RTP, and may be three IE (Internet Explorer) client devices that each have an embedded protocol plug-in installed.
  • the proxy device 304 has no tunnel encapsulation function and only provides a forwarding function as a general proxy.
  • the proxy device 305 has a tunnel encapsulation function and also has the function of aggregating data requests sent by the client device, and can aggregate data requests sent by multiple client devices into one.
  • Server 306 can be a web server.
  • the client devices 301 and 302 both initiate a tunnel negotiation request to the server 306, and the tunnel negotiation request sent by each client device carries the identifier of the embedded protocol supported by the client device and the identifier of the program requested by the client device. It can also include the identity of the client device.
  • the tunnel negotiation request passes through the proxy device 304 and is forwarded to the server 306.
  • the server 306 identifies the embedded protocol supported by the client device. If the server 306 does not recognize the embedded protocol supported by the client devices 301 and 302, an error response is sent to the client devices 301 and 302 indicating that the client device tunnel negotiation was unsuccessful. If the server 306 is capable of supporting the identified embedding protocol, an embedding protocol is selected therefrom to establish an optimized connection with the designated proxy device using the selected embedding protocol.
  • the proxy device 305 having the tunnel function is specified according to the predetermined policy, and the tunnel designation message is sent to the proxy device 305.
  • the tunnel designation message includes an identifier of the selected protocol, an identifier of the program requested to be viewed, and may also include an identifier of the client device.
  • the proxy device 305 After receiving the tunnel designation message, the proxy device 305 first determines whether the embedded protocol selected by the server is supported. If not, the proxy device 305 sends an error response to the server 306, and after receiving the error response, the server 306 also sends the error to the client device 301.
  • the 302 issues an error response indicating that the tunnel negotiation was unsuccessful; if the proxy device 305 supports the embedded protocol selected by the server, the proxy device 305 and the server 306 employ the embedded protocol to establish an optimized connection. Then, the server and the proxy device respectively establish and save the corresponding relationship between the optimized connection and the program requested by the client devices 301 and 302.
  • the corresponding relationship established by the server is referred to as a first correspondence, and the corresponding relationship established by the proxy device is called The second correspondence.
  • the proxy device 305 sends a tunnel designation success response to the server 306 indicating that the tunnel negotiation and establishment between the proxy device 305 and the server 306 was successful.
  • the server 306 After receiving the tunnel designation success response sent by the proxy device 305, the server 306 sends the identifier of the proxy device 305 to the client devices 301 and 302 to notify the client devices 301 and 302 to send the data request to the proxy device 305. Wherein, the server may carry the identifier of the proxy device 305 in the tunnel association The quotient success response is sent to client devices 301 and 302. At this point, the tunnel negotiation is successful.
  • Client devices 301 and 302 concurrently send data requests, such as data transfer requests, to proxy device 305.
  • the proxy device 305 aggregates the received multiple data requests into one, such as a bulk data req, forwarded to the server.
  • the proxy device 305 also establishes a third correspondence, which includes the correspondence between the client device and the optimized connection.
  • the server 106 responds to the data request sent by the proxy device, generates response data for each program, and connects the response data for each program to the proxy device 305 through the optimization of each program.
  • the client device corresponding to the optimized connection is 301 and 302 from the third correspondence, and then the encapsulated response data is copied into two copies and sent to the client respectively.
  • the server 306 After receiving the tunnel negotiation request, the server 306 also selects the same embedded protocol, specifies the proxy device 305, and then sends a tunnel designation message to the proxy device 305. After receiving the tunnel designation message, the proxy device 305 detects that the optimized connection corresponding to the program requested by the client device 303 has been established from the second corresponding relationship, and does not need to establish a new multicast connection, and responds to the server 306 with the connection channel update message. After receiving the connection channel update message, the server 306 sends a tunnel negotiation success response to the client device 303. After receiving the tunnel negotiation success response, the client device 303 sends a data request to the proxy device 305 to obtain the data of the program requested to be viewed. The proxy device updates the third correspondence and adds the identity of the client device 303.
  • a disconnection req is sent to the proxy device 305, which carries information such as the identifier of the program and the identifier of the client device; of course, the client device 301 stops watching the program.
  • the proxy device 305 may also be not notified.
  • the proxy device 305 senses whether the client device 301 has stopped watching the program through a preset mechanism (such as timeout or the like). After the proxy device 305 knows that the client device 301 has stopped watching the program, it updates its saved third correspondence, and can send a connection channel update message to the server 306, notifying the server that the client device is offline, so that the server wants the client.
  • the end device does some other services, such as statistics.
  • server 306 Upon receipt of the connection channel update message, server 306 responds to proxy device 305 with a connection channel update response. If the client device 301 issues a disconnect request, the proxy device 305 issues a disconnection ack to the client device 301 after updating its saved third correspondence.
  • the client device corresponding to an optimized connection is all When the department stops watching the corresponding program, the optimized connection needs to be dismantled to release resources. This teardown operation may be initiated by proxy device 305 or may be initiated by server 306.
  • an embodiment of the present invention provides a server, including:
  • the obtaining module 410 is configured to obtain an embedded protocol supported by the client device.
  • connection establishing module 420 configured to specify a proxy device, and establish an optimized connection connected to the proxy device by using an embedded protocol supported by the client device;
  • the receiving module 430 is configured to receive, by the proxy device, a data request from the client device.
  • the response module 440 is configured to generate response data based on the embedded protocol, and send the response data to the proxy device by using the optimized connection, so that the proxy device performs the response data by using a hypertext transfer protocol.
  • the layer is encapsulated and sent to the client device.
  • the acquiring module 410 is specifically configured to receive a tunnel negotiation request sent by the client device, where the tunnel negotiation request includes an identifier of an embedded protocol supported by the client device and a program requested by the client device.
  • the embedded protocol includes a WebSocket protocol and/or a multicast protocol.
  • the server may further include: a relationship establishing module, configured to establish and save a first correspondence after the connection establishing module successfully establishes an optimized connection connected to the proxy device, where the first correspondence is
  • the method at least includes: a correspondence between the program requested by the client device and the optimized connection.
  • the response module 440 may be configured to generate response data of the program according to the identifier of the program included in the data request, and obtain an optimized connection corresponding to the program according to the first correspondence relationship, The response data of the program is sent to the proxy device via an optimized connection corresponding to the program.
  • the server may further include: a querying module, configured to query whether an optimized connection of the program already exists in the first correspondence; if not, instructing the connection establishing module 420 to establish a connection to the proxy An optimized connection of the device; if it already exists, it is determined to adopt the established optimized connection.
  • a querying module configured to query whether an optimized connection of the program already exists in the first correspondence; if not, instructing the connection establishing module 420 to establish a connection to the proxy An optimized connection of the device; if it already exists, it is determined to adopt the established optimized connection.
  • connection establishing module 420 is specifically configured to send a tunnel designation message to the proxy device, where the tunnel designation message carries an embedded protocol supported by the client device, so as to Establishing an optimized connection connected to the proxy device by using the embedded protocol, after the optimized connection is successfully established, the server sends the identifier of the proxy device to the client device to indicate that the client device is to be used A data request for requesting program data is sent to the proxy device.
  • the server may specifically be a computer, and includes: a central processing unit (CPU), a memory, an external connection device, and the like.
  • the server provided by the embodiment of the present invention, on the one hand, when the designated proxy device fails, the server may change the designated proxy device, establish an optimized connection with the changed proxy device, and perform data interaction with the client, thereby securing the client and the client.
  • the data transmission between the servers is not interrupted; on the other hand, an optimized connection can be established with the proxy device using the embedded protocol supported by the client, and the data request sent by the client device through the proxy device and the response returned by the server are transmitted through the optimized connection.
  • the data can have better transmission efficiency, thereby reducing the pressure on the server, especially the concurrent user requesting pressure on the server in the live broadcast scenario.
  • an embodiment of the present invention provides a proxy device, where the proxy device can be a server, including:
  • the request forwarding module 510 is configured to forward the data request sent by the received client device to the server;
  • a data receiving module 520 configured to receive response data sent by the server through an established optimized connection, where the optimized connection is established by the proxy device and the server using an embedded protocol supported by the client device, The response data is based on response data of the embedded protocol;
  • the data sending module 530 is configured to send the response data to the client device by using a hypertext transfer protocol.
  • proxy device may further include:
  • connection establishing module configured to receive a tunnel designation message sent by the server, where the tunnel designation message carries an identifier of an embedded protocol supported by the client device and an identifier of a program requested by the client device, An embedded protocol supported by the client device establishes an optimized connection with the server.
  • a relationship establishing module configured to: after the optimized connection is successfully established, update a second correspondence according to the optimized connection and the tunnel designation message, where the second correspondence includes: the client device requests to view The correspondence between the program and the optimized connection.
  • the proxy device may further include:
  • a querying module configured to query whether the optimized connection corresponding to the program already exists in the second corresponding relationship; if not, instructing the connection establishing module to establish with the server by using an embedded protocol supported by the client device Optimize the connection; if it already exists, then determine to use the existing optimized connection.
  • the relationship establishing module may be further configured to: before the request forwarding module 610 forwards the received data request sent by the client device to the server, establishing and saving a third correspondence, the third correspondence
  • the relationship includes at least: the correspondence between the client device and the optimized connection.
  • the data sending module 530 may be specifically configured to query, from the third correspondence, the client device corresponding to the optimized connection; and the response data that is encapsulated by using a hypertext transfer protocol. Sended to the client device that the query is sent to.
  • the proxy device may specifically be a computer, and includes: a central processing unit (CPU), a memory, an external connection device, and the like.
  • CPU central processing unit
  • memory volatile and non-volatile memory
  • external connection device external connection device
  • the proxy device provided by the embodiment of the present invention may establish an optimized connection with the server using an embedded protocol supported by the client, and transmit the data request sent by the client device through the proxy device and the response data returned by the server through the optimized connection, relative to the existing
  • the HTTP connection in the technology transmits data, which can have better transmission efficiency, and thus can alleviate the pressure on the server, especially the pressure that the concurrent users request to the server in the live broadcast scenario.
  • the storage medium may include: a read only memory, a random read memory, a magnetic disk or an optical disk, and the like.

Abstract

The embodiments of this invention disclose a method for data transmission, which includes: a sever obtains the embedded protocol which a client device supports; the server designates a proxy device and establishes, using the embedded protocol which the client device supports, an optimized connection linked to the proxy device; the server receives a data request from the client device which is forwarded by the proxy device, generates response data based on the embedded protocol, and transmits the response data to the proxy device through the optimized connection, and thereby the proxy device transmits the response data after outer encapsulation to the client device using Hyper Text Transfer Protocol (HTTP). The embodiments of this invention also provide the corresponding server and proxy device. In the technical solution of this invention, when the designated proxy device breaks down, the server can change the designated proxy device; the optimized connection which has better transmission efficiency than HTTP connection is established between the server and the proxy device, which can relieve pressure of the server, especially the pressure of the server which is caused by concurrent user requests under the live scene.

Description

数据传输方法和设备 技术领域  Data transmission method and device
本发明涉及通信技术领域, 具体涉及一种数据传输方法和设备。  The present invention relates to the field of communications technologies, and in particular, to a data transmission method and device.
背景技术 Background technique
随着计算机技术的飞速发展,利用网络传输声音和视频信号的需求越来越 大, 流媒体 ( streaming media )技术的应用也就越来越广。 特别是基于现有的 超文本传输协议 ( Hyper Text Transfer Protocol, HTTP ) 的超文本传输协议流 ( HTTP streaming )技术, 由于可以利用现有的 HTTP技术构建服务器和客户 端, 使得流媒体的应用更加广泛。  With the rapid development of computer technology, the demand for transmitting sound and video signals through the network is increasing, and the application of streaming media technology is becoming more and more widespread. In particular, the hypertext transfer protocol (HTTP streaming) technology based on the existing Hyper Text Transfer Protocol (HTTP), because the existing HTTP technology can be used to build servers and clients, making streaming applications more widely.
但 HTTP是一种单播协议, 当网络(web )服务器的访问数据量大, 服务 的用户多时, 便产生一些并发问题。 在一些应用场景中, 服务器可能需要为海 量的用户提供服务, 势必会对服务器的性能以及网络带宽等造成很大的压力。  However, HTTP is a unicast protocol. When the amount of data accessed by the network (web) server is large and the number of users of the service is large, some concurrency problems arise. In some application scenarios, the server may need to provide services for a large number of users, which will inevitably put a lot of pressure on the performance of the server and network bandwidth.
为减轻并发用户请求对服务器的压力, 通常在服务器和用户之间增加代 理, 利用代理(proxy ) 的緩存功能来緩解服务器压力。 当用户通过代理访问 服务器时, 代理将访问的数据先緩存下来, 再发送给请求用户, 当后续其它用 户再访问相同数据时,代理可以直接将緩存的数据发送给用户, 而不用重新从 服务器获取数据, 这样就减少了代理到服务器的带宽压力。  To alleviate the pressure on concurrent servers from concurrent users, it is common to add agents between servers and users, and use proxy caching to ease server stress. When the user accesses the server through the proxy, the proxy caches the accessed data first and then sends it to the requesting user. When subsequent users access the same data again, the proxy can directly send the cached data to the user without re-acquiring from the server. Data, which reduces the bandwidth pressure from the agent to the server.
但是, 在直播场景, 例如观看电视节目时, 要求数据传输没有延迟或者延 迟很小, 则视频等数据无法被预先緩存下来,代理无法利用緩存来减轻并发用 户请求对服务器造成的压力。  However, in live broadcast scenarios, such as watching TV programs, data transmission is not delayed or delayed, data such as video cannot be pre-cached, and the proxy cannot use the cache to alleviate the pressure on the server from concurrent requests.
发明内容 Summary of the invention
本发明实施例提供一种数据传输方法和设备,能够在直播场景减轻并发用 户请求对服务器造成的压力。  The embodiment of the invention provides a data transmission method and device, which can reduce the pressure on the server caused by concurrent users in the live broadcast scenario.
一种数据传输方法, 包括:  A data transmission method includes:
服务器获取客户端设备支持的嵌入协议;  The server obtains an embedded protocol supported by the client device;
所述服务器指定一个代理设备, 采用所述客户端设备支持的嵌入协议, 建 立连接到所述代理设备的优化连接;  The server specifies a proxy device, and establishes an optimized connection connected to the proxy device by using an embedded protocol supported by the client device;
所述服务器接收所述代理设备转发的, 来自于所述客户端设备的数据请 求; Receiving, by the server, data from the client device that is forwarded by the proxy device begging;
所述服务器生成基于所述嵌入协议的响应数据,将所述响应数据通过所述 优化连接发送给所述代理设备,以便所述代理设备采用超文本传输协议将所述 响应数据进行外层封装后发送给所述客户端设备。  The server generates response data based on the embedded protocol, and sends the response data to the proxy device through the optimized connection, so that the proxy device encapsulates the response data by using a hypertext transfer protocol. Sent to the client device.
一种数据传输方法, 包括:  A data transmission method includes:
代理设备将收到的客户端设备发送的数据请求转发给服务器;  The proxy device forwards the received data request sent by the client device to the server;
所述代理设备接收所述服务器通过已建立的优化连接发送的响应数据,所 述优化连接是所述代理设备与所述服务器采用所述客户端设备支持的嵌入协 议建立的, 所述响应数据是基于所述嵌入协议的响应数据;  Receiving, by the proxy device, response data sent by the server through an established optimized connection, where the optimized connection is established by the proxy device and the server using an embedded protocol supported by the client device, and the response data is Response data based on the embedded protocol;
所述代理设备采用超文本传输协议将所述响应数据进行外层封装后发送 给所述客户端设备。  And the proxy device sends the response data to the client device by using a hypertext transfer protocol.
一种服务器, 包括:  A server, comprising:
获取模块, 用于获取客户端设备支持的嵌入协议;  An obtaining module, configured to obtain an embedded protocol supported by the client device;
连接建立模块, 用于指定一个代理设备, 采用所述客户端设备支持的嵌入 协议, 建立连接到所述代理设备的优化连接;  a connection establishing module, configured to specify a proxy device, and establish an optimized connection connected to the proxy device by using an embedded protocol supported by the client device;
接收模块, 用于接收所述代理设备转发的, 来自于所述客户端设备的数据 请求;  a receiving module, configured to receive, by the proxy device, a data request from the client device;
响应模块, 用于生成基于所述嵌入协议的响应数据,将所述响应数据通过 所述优化连接发送给所述代理设备,以便所述代理设备采用超文本传输协议将 所述响应数据进行外层封装后发送给所述客户端设备。  a response module, configured to generate response data based on the embedded protocol, and send the response data to the proxy device by using the optimized connection, so that the proxy device performs the outer layer of the response data by using a hypertext transfer protocol After being encapsulated, it is sent to the client device.
一种代理设备, 包括:  An agent device, including:
请求转发模块, 用于将收到的客户端设备发送的数据请求转发给服务器; 数据接收模块,用于接收所述服务器通过已建立的优化连接发送的响应数 据,所述优化连接是所述代理设备与所述服务器采用所述客户端设备支持的嵌 入协议建立的, 所述响应数据是基于所述嵌入协议的响应数据;  a request forwarding module, configured to forward the data request sent by the received client device to the server; the data receiving module is configured to receive response data sent by the server through the established optimized connection, where the optimized connection is the proxy The device and the server are established by using an embedded protocol supported by the client device, and the response data is response data based on the embedded protocol;
数据发送模块,用于采用超文本传输协议将所述响应数据进行外层封装后 发送给所述客户端设备。  And a data sending module, configured to send the response data to the client device by using a hypertext transfer protocol.
本发明实施例提供的数据传输方法, 一方面, 在指定的代理设备故障时, 服务器可以更改指定的代理设备; 另一方面,在服务器和代理设备之间建立起 比 HTTP连接具有更优传输效率的优化连接来传输数据,可以减轻服务器的压 力, 特别是直播场景下并发用户请求对服务器造成的压力。 The data transmission method provided by the embodiment of the present invention, on the one hand, the server can change the designated proxy device when the designated proxy device fails; on the other hand, establishes between the server and the proxy device Optimized connections with better transmission efficiency than HTTP connections can transmit data, which can alleviate the pressure on the server, especially the concurrent users requesting pressure on the server in the live broadcast scenario.
附图说明 DRAWINGS
图 1是本发明一个实施例提供的数据传输方法的流程图;  1 is a flowchart of a data transmission method according to an embodiment of the present invention;
图 2是本发明另一实施例提供的数据传输方法的流程图;  2 is a flowchart of a data transmission method according to another embodiment of the present invention;
图 3是本发明一个应用场景例的流程图;  3 is a flow chart of an application scenario example of the present invention;
图 4是本发明实施例提供的服务器的示意图;  4 is a schematic diagram of a server according to an embodiment of the present invention;
图 5是本发明实施例提供的代理设备的示意图。  FIG. 5 is a schematic diagram of a proxy device according to an embodiment of the present invention.
具体实施方式 detailed description
通常,服务器和客户端设备之间设置有代理设备, 以便利用该代理设备的 緩存功能来緩解服务器压力。所说的代理设备一般是预先配置好的,客户端设 备默认通过该代理设备向服务器请求数据。 但是, 一旦该代理设备发生故障, 客户端与服务器之间的连接就会中断,客户端设备发送的数据请求就不能到达 服务器, 也不能收到服务器发送的响应数据。  Typically, a proxy device is placed between the server and the client device to take advantage of the proxy device's caching capabilities to ease server stress. The proxy device is generally pre-configured, and the client device requests data from the server through the proxy device by default. However, once the proxy device fails, the connection between the client and the server is interrupted, and the data request sent by the client device cannot reach the server or receive the response data sent by the server.
另外, 客户端设备和服务器之间、 服务器和代理设备之间、 以及代理设备 和客户端设备之间通常采用单播协议 HTTP建立 HTTP连接并传递数据,客户端 设备收到的是以 HTTP进行单层封装的数据。但是, HTTP连接的数据传输效率 较低, 会导致服务器的压力较大。  In addition, between the client device and the server, between the server and the proxy device, and between the proxy device and the client device, a unicast protocol HTTP is usually used to establish an HTTP connection and transfer data, and the client device receives the HTTP. Layer encapsulated data. However, the data transfer efficiency of the HTTP connection is low, which will cause the server to be under pressure.
为解决上述问题, 本发明实施例提供一种数据传输方法,一方面由服务器 指定代理设备, 客户端设备通过该服务器指定的代理设备向服务器请求数据; 另一方面, 在服务器和代理设备之间建立比 HTTP连接具有更优传输效率的连 接, 进行数据传输。 本文中将所述比 HTTP连接具有更优传输效率的连接称为 优化连接, 该优化连接可以是 WebSocket连接或者多播连接。 从而, 一方面, 在当前的代理设备故障时,服务器可以再指定其它的代理设备,客户端可以通 过其它代理设备与服务器进行数据交互以获取请求的数据; 另一方面,优化连 接例如 WebSocket连接或者多播连接比 HTTP连接具有更高的数据传输效率,可 以减轻服务器的压力。本发明实施例还提供相应的设备及系统。 以下分别进行 详细说明。  To solve the above problem, an embodiment of the present invention provides a data transmission method. On one hand, a server designates a proxy device, and a client device requests data from a server through a proxy device specified by the server. On the other hand, between the server and the proxy device. Establish a connection with better transmission efficiency than HTTP connection for data transmission. The connection that has better transmission efficiency than the HTTP connection is referred to herein as an optimized connection, and the optimized connection may be a WebSocket connection or a multicast connection. Thus, on the one hand, when the current proxy device fails, the server can further specify other proxy devices, and the client can perform data interaction with the server through other proxy devices to obtain the requested data; on the other hand, optimize the connection such as a WebSocket connection or Multicast connections have higher data transfer efficiency than HTTP connections, which can alleviate server stress. Embodiments of the present invention also provide corresponding devices and systems. The following is a detailed description.
请参考图 1 , 本发明实施例提供一种数据传输方法, 包括: 110、 服务器获取客户端设备支持的嵌入协议。 Referring to FIG. 1 , an embodiment of the present invention provides a data transmission method, including: 110. The server obtains an embedded protocol supported by the client device.
本发明实施例在服务器和代理设备之间, 采用传输效率比 HTTP协议更优 的、 客户端设备支持的嵌入协议, 建立优化连接进行数据传输, 所说的嵌入协 议可以是 WebSocket协议或者多播协议。 代理设备收到的服务器发送的数据将 是采用该嵌入协议封装的数据, 代理设备需要采用 HTTP协议对收到的数据进 行外层封装后, 才能通过 HTTP连接发送给客户端设备。 最终, 客户端设备收 到的数据将是以所说的嵌入协议作为内层封装协议、 以 HTTP协议作为外层封 装协议进行双层封装的数据。这就要求客户端设备要具备解析采用双层协议封 装的数据的能力, 本文中把客户端设备的这种能力称为客户端设备的隧道能 力。 服务器与代理设备建立优化连接之前, 可以获取客户端设备的隧道能力, 以便采用客户端支持的嵌入协议与代理设备建立优化连接。  In the embodiment of the present invention, an embedded protocol supported by the client device is used between the server and the proxy device, and the embedded protocol supported by the client device is used to establish an optimized connection for data transmission. The embedded protocol may be a WebSocket protocol or a multicast protocol. . The data sent by the server received by the proxy device will be the data encapsulated by the embedded protocol. The proxy device needs to use the HTTP protocol to encapsulate the received data before sending it to the client device through the HTTP connection. Finally, the data received by the client device will be double-encapsulated with the embedded protocol as the inner layer encapsulation protocol and the HTTP protocol as the outer encapsulation protocol. This requires the client device to have the ability to parse data encapsulated in a two-tier protocol. This capability of the client device is referred to as the tunneling capability of the client device. Before the server establishes an optimized connection with the proxy device, the tunnel capability of the client device can be obtained, so as to establish an optimized connection with the proxy device by using an embedded protocol supported by the client.
客户端设备在发送数据请求给服务器之前,可以先发送隧道协商请求给服 务器,将客户端设备的隧道能力携带在隧道协商请求中告知服务器。该隧道协 商请求中包括: 客户端设备支持的嵌入协议的标识,客户端设备请求的数据内 容例如请求收看的节目的标识; 还可以包括: 客户端设备的标识。  The client device may send a tunnel negotiation request to the server before sending the data request to the server, and the tunneling capability of the client device is carried in the tunnel negotiation request to notify the server. The tunnel negotiation request includes: an identifier of the embedded protocol supported by the client device, and a data content requested by the client device, for example, an identifier of the program requested to be viewed; and the identifier of the client device.
在直播场景中,所说的客户端设备请求收看的节目的标识可以是频道号或 者频率( frequency )等任何能够标识请求收看的节目的信息。 所说的嵌入协议 的标识可以是嵌入协议的名称、 代号或者 ID ( IDentity )等任何能够标识该嵌 入协议的信息。 所说的嵌入协议可以是 WebSocket协议或者多播协议, 多播协 议具体可以是实时流传输协议( Real Time Streaming Protocol , RTSP )或者实 时传送协议(Real-time Transport Protocol, RTP )。 所说客户端设备的标识是任 何可以标识客户端的信息, 例如客户端的网际协议 ( Internet Protocol, IP )地 址。  In the live broadcast scenario, the identifier of the program requested by the client device may be any information such as a channel number or a frequency (frequency) that can identify the program requested to be viewed. The identifier of the embedded protocol may be any name that identifies the embedded protocol, such as the name, code, or ID (IDentity) of the embedded protocol. The embedded protocol may be a WebSocket protocol or a multicast protocol, and the multicast protocol may be a Real Time Streaming Protocol (RTSP) or a Real-Time Transport Protocol (RTP). The identity of the client device is any information that can identify the client, such as the Internet Protocol (IP) address of the client.
服务器通过接收客户端设备发送的隧道协商请求,来识别客户端设备的隧 道能力。如果客户端设备支持的嵌入协议有两种或者两种以上, 则服务器可以 从其中选择一种,作为后续与代理设备建立优化连接采用的协议。如果客户端 设备支持的嵌入协议只有一种, 则服务器直接选择该嵌入协议,作为后续与代 理设备建立优化连接采用的协议。 如果服务器无法识别客户端设备的隧道能 力, 即, 不能识别客户端设备支持的嵌入协议的标识, 则可以回应错误响应给 客户端设备。 The server identifies the tunnel capability of the client device by receiving a tunnel negotiation request sent by the client device. If the client device supports two or more embedding protocols, the server may select one of them as a protocol for subsequent establishment of an optimized connection with the proxy device. If there is only one type of embedding protocol supported by the client device, the server directly selects the embedding protocol as a protocol for subsequent establishment of an optimized connection with the proxy device. If the server does not recognize the tunneling capability of the client device, ie, it does not recognize the identity of the embedded protocol supported by the client device, it can respond to the error response. Client device.
120、 服务器指定一个代理设备, 采用所述客户端设备支持的嵌入协议, 建立连接到指定的代理设备的优化连接。  120. The server specifies a proxy device, and uses an embedded protocol supported by the client device to establish an optimized connection that is connected to the specified proxy device.
服务器可以按照策略从当前可用的代理设备中指定一个代理设备,与指定 的代理设备建立优化连接。所说的策略可以是: 比较各个可用的代理设备的负 担,指定其中负担较小的代理设备, 例如比较各个代理设备连接的客户端设备 的数量,指定其中连接的客户端设备较少的代理设备; 还可以是比较代理设备 相对于服务器的距离, 例如跳数(hop count ), 与一个标准值的差值, 指定其 中差值最小的代理设备; 或者也可以比较各个可用的代理设备的指数, 该指数 根据代理设备的负担以及相对于服务器的距离加权得到,指定其中指数最大或 最小的代理设备。  The server can specify an agent device from the currently available proxy devices according to the policy to establish an optimized connection with the specified proxy device. The said policy may be: comparing the burden of each available proxy device, specifying a proxy device with less burden, such as comparing the number of client devices connected to each proxy device, and specifying a proxy device in which fewer client devices are connected It is also possible to compare the distance of the proxy device relative to the server, such as a hop count, a difference from a standard value, specify the proxy device with the smallest difference; or compare the indices of the available proxy devices. The index is weighted according to the burden of the proxy device and the distance from the server, specifying the proxy device with the largest or smallest index.
服务器指定代理设备之后,发送隧道指定消息给指定的代理设备。该隧道 指定消息中, 包括客户端设备支持的嵌入协议的标识。如果服务器在客户端设 备支持的嵌入协议选择了一种,则隧道指定消息中只包括该被选择嵌入协议的 标识。该隧道指定消息中还可以包括客户端设备请求收看的节目的标识。该隧 道指定消息中还可以包括客户端设备的标识, 例如客户端设备的 IP地址, 客户 端设备的 IP地址可以从隧道协商请求中获得。若代理设备支持隧道指定消息中 的至少一种嵌入协议,则采用隧道指定消息中有的并且其支持的嵌入协议嵌入 协议与服务器建立优化连接,如果隧道指定消息中有的并且其支持的嵌入协议 多于一种, 则选择其中一种嵌入协议与服务器建立优化连接。 举例来说, 该优 化连接可以是: WebSocket连接, 或者 RTSP连接, 或者 RTP连接。 代理设备可 以发送隧道指定成功响应给服务器, 以表示优化连接已建立成功。  After the server specifies the proxy device, it sends a tunnel designation message to the specified proxy device. The tunnel specifies the identifier of the embedded protocol supported by the client device. If the server selects one of the embedded protocols supported by the client device, the tunnel designation message includes only the identity of the selected embedded protocol. The tunnel designation message may further include an identifier of a program requested by the client device to view. The tunnel designation message may also include an identifier of the client device, such as an IP address of the client device, and the IP address of the client device may be obtained from the tunnel negotiation request. If the proxy device supports at least one of the embedded protocol in the tunnel designation message, the embedded protocol embedded protocol and the supported embedded protocol embedding protocol are used to establish an optimized connection with the server, if the tunnel designation message is present and the embedded protocol it supports If there is more than one, choose one of the embedded protocols to establish an optimized connection with the server. For example, the optimized connection can be: a WebSocket connection, or an RTSP connection, or an RTP connection. The proxy device can send a tunnel specifying a successful response to the server to indicate that the optimized connection has been established successfully.
在优化连接建立完成后,服务器建立并保存该优化连接的标识与客户端设 备请求收看的节目的标识之间的第一对应关系。如果第一对应关系已存在, 则 根据该优化连接的标识与客户端设备请求收看的节目的标识更新第一对应关 系,即如果该优化连接的标识与客户端设备请求收看的节目的标识的对应关系 不在第一对应关系中, 则将其加入第一对应关系中。该第一对应关系可以以对 应关系表的形式保存, 称为第一对应关系表, 如表 1所示, 其中, 可以用数字 编号例如 101作为优化连接的标识, 可以用频道号例如中央一套(CCTV1 )作 为客户端设备请求收看的节目的标识, 也可以用频率例如 CCTV1对应的频率 57.75MHz作为请求收看的节目的标识。 After the optimized connection establishment is completed, the server establishes and saves a first correspondence between the identifier of the optimized connection and the identifier of the program requested by the client device to view. If the first correspondence exists, the first correspondence is updated according to the identifier of the optimized connection and the identifier of the program requested by the client device, that is, if the identifier of the optimized connection corresponds to the identifier of the program requested by the client device If the relationship is not in the first correspondence, it is added to the first correspondence. The first correspondence may be saved in the form of a correspondence table, which is referred to as a first correspondence table, as shown in Table 1, wherein a digital number such as 101 may be used as an identifier for optimizing the connection, and a channel number such as a central set may be used. (CCTV1) The identifier of the program requested to be viewed by the client device may also be the frequency 57.75 MHz corresponding to the frequency of the CCTV 1 as the identifier of the program to be viewed.
如果代理设备收到的隧道指定消息中还包括客户端设备请求收看的节目 的标识, 则在优化连接建立完成后,代理设备中也可以建立并保存该优化连接 的标识与该客户端设备请求收看的节目的标识之间的对应关系,称为第二对应 关系, 具体也可以是对应关系表的形式, 如图 1所示。 如果第二对应关系已存 在,则根据该优化连接的标识与隧道指定消息中包括的客户端设备请求收看的 节目的标识更新第二对应关系,即如果该优化连接的标识与客户端设备请求收 看的节目的标识的对应关系不在第二对应关系中, 则将其加入第二对应关系 中。  If the tunnel designation message received by the proxy device further includes the identifier of the program requested by the client device, after the optimized connection is established, the proxy device may also establish and save the identifier of the optimized connection and request the viewing by the client device. The correspondence between the identifiers of the programs is called the second correspondence, and may also be the form of the correspondence table, as shown in FIG. 1 . If the second correspondence exists, the second correspondence is updated according to the identifier of the optimized connection and the identifier of the program requested by the client device included in the tunnel designation message, that is, if the identifier of the optimized connection and the client device request to view The correspondence of the identifiers of the programs is not in the second correspondence, and is added to the second correspondence.
表 1  Table 1
节目的标识 优化连接的标识  Identification of the program
CCTV1 101  CCTV1 101
CCTV4 102  CCTV4 102
103  103
CCTV6  CCTV6
104  104
通常,代理设备与服务器之间的优化连接与客户端设备请求收看的节目是 一一对应的关系。服务器在收到携带节目标识的隧道协商请求后, 可以查询保 存的第一对应关系中是否已经存在该节目的优化连接,如果不存在,说明尚未 建立该节目的优化连接, 则服务器与代理设备才建立该节目的优化连接; 如果 已经存在该节目的优化连接, 服务器与代理设备可以不再建立新的优化连接, 而是采用已建立的该节目的优化连接。服务器也可以不进行查询, 而是将节目 的标识携带在隧道指定消息中发送给代理设备,由代理设备查询保存的第二对 应关系中是否已经存在该节目的优化连接, 如果不存在,代理设备与服务器才 建立该节目的优化连接; 如果已经存在,代理设备与服务器可以不再建立新的 优化连接, 而是利用已建立的该节目的优化连接。  Generally, the optimized connection between the proxy device and the server has a one-to-one correspondence with the program requested by the client device. After receiving the tunnel negotiation request carrying the program identifier, the server may query whether the optimized connection of the program already exists in the saved first correspondence, and if it does not exist, indicating that the optimized connection of the program has not been established, the server and the proxy device are Establishing an optimized connection for the program; if an optimized connection to the program already exists, the server and the proxy device may no longer establish a new optimized connection, but instead employ an established optimized connection of the program. The server may also not carry out the query, but the identifier of the program is carried in the tunnel designation message and sent to the proxy device, and the proxy device queries whether the optimized connection of the program already exists in the saved second correspondence, if not, the proxy device An optimized connection to the program is established with the server; if it already exists, the proxy device and the server can no longer establish a new optimized connection, but instead utilize the established optimized connection of the program.
其中,如果服务器或者代理设备查询发现已存在与客户端设备请求收看的 节目的标识对应的优化连接, 可以进一步判断该优化连接的负担是否过重, 例 如承载的数据流量是否达到阈值,如果达到,代理设备与服务器可以另外再建 一条对应于所说的节目的优化连接, 以分担部分数据流量。 从而, 所说的第一 或第二对应关系中, 一个节目可以对应于一个以上优化连接。 例如表 1中, 节 目 CCTV6就对应有两个优化连接 103和 104。 但是, 每个优化连接只能对应于 一个节目。 If the server or the proxy device queries that the optimized connection corresponding to the identifier of the program requested by the client device is found, the burden of the optimized connection may be excessively determined, for example, whether the data traffic of the bearer reaches a threshold, and if so, Agent device and server can be rebuilt An optimized connection corresponding to said program to share part of the data traffic. Thus, in the first or second correspondence, one program may correspond to more than one optimized connection. For example, in Table 1, the program CCTV 6 corresponds to two optimized connections 103 and 104. However, each optimized connection can only correspond to one program.
服务器或者代理设备还可以把客户端设备的标识, 例如 IP地址, 保存在自 己建立的第一或第二对应关系中, 如表 2所示。 客户端设备的 IP地址可以从隧 道协商请求获得, 例如从隧道协商请求的源地址字段获得。 这样, 前文所说的 进一步判断优化连接的负担是否过重具体也可以是,判断优化连接对应的客户 端设备的数量是否达到阈值。  The server or proxy device may also store the identity of the client device, such as an IP address, in its first or second correspondence, as shown in Table 2. The IP address of the client device can be obtained from the tunnel negotiation request, for example, from the source address field of the tunnel negotiation request. In this way, it is also possible to determine whether the burden of optimizing the connection is too heavy, as described above, and determine whether the number of client devices corresponding to the optimized connection reaches a threshold.
表 2  Table 2
节目的标识 优化连接的标识 客户端设备的标识 Identification of the program ID of the optimized connection Identification of the client device
CCTV1 101 192.168.1.8 CCTV1 101 192.168.1.8
192.168.1.95  192.168.1.95
CCTV4 102  CCTV4 102
192.168.1.77  192.168.1.77
103 192.168.1.34  103 192.168.1.34
CCTV6  CCTV6
104 192.168.1.55  104 192.168.1.55
如果服务器指定的代理设备不支持服务器选择的嵌入协议,该代理设备发 送错误响应给服务器。 服务器收到错误响应后可以重新指定一个新的代理设 备, 与该新的代理设备建立优化连接; 服务器收到错误响应后也可以拒绝客户 端的隧道协商请求, 即, 发送隧道协商失败消息给客户端设备。  If the proxy device specified by the server does not support the embedded protocol selected by the server, the proxy device sends an error response to the server. After receiving the error response, the server can re-designate a new proxy device to establish an optimized connection with the new proxy device. After receiving the error response, the server can also reject the client's tunnel negotiation request, that is, send a tunnel negotiation failure message to the client. device.
服务器与指定的代理设备成功建立起优化连接后,服务器将该指定的代理 设备的标识发送给客户端设备,以指示客户端设备将用于请求节目数据的数据 请求发送给该指定的代理设备,通过该代理设备向服务器请求数据。服务器还 可以将优化连接的标识发送给客户端设备。 一种实施方式中,服务器可以将指 定的代理设备的标识携带在隧道协商成功响应中发送给给客户端设备。客户端 设备收到代理设备的标识后, 就可以向该代理设备发送数据请求, 以请求节目 数据。  After the server successfully establishes an optimized connection with the specified proxy device, the server sends the identifier of the specified proxy device to the client device to instruct the client device to send a data request for requesting program data to the designated proxy device. Data is requested from the server through the proxy device. The server can also send the identity of the optimized connection to the client device. In an implementation manner, the server may send the identifier of the specified proxy device to the client device in a tunnel negotiation success response. After the client device receives the identity of the proxy device, it can send a data request to the proxy device to request program data.
130、 服务器接收代理设备转发的, 来自于客户端设备的数据请求, 生成 基于所述嵌入协议的响应数据通过所述优化连接发送给所述代理设备,以便所 述代理设备采用 HTTP协议将所述响应数据进行外层封装后发送给所述客户端 设备。 130. The server receives, by the proxy device, a data request from the client device, and generates response data based on the embedded protocol, and sends the response data to the proxy device by using the optimized connection. The proxy device uses the HTTP protocol to externally encapsulate the response data and then sends the response data to the client device.
该数据请求为 HTTP请求, 代理设备根据该数据请求建立与客户端设备间 的 HTTP连接。  The data request is an HTTP request, and the proxy device establishes an HTTP connection with the client device based on the data request.
客户端设备获得服务器发送的代理设备的标识后,即可发送用于请求节目 数据的数据请求给代理设备。该数据请求中包括客户端设备请求收看的节目的 标识和客户端的标识。 在服务器将优化连接的标识发送给客户端设备的情况 下, 该数据请求中也可以包括优化连接的标识和客户端的标识, 或者包括客户 端设备请求收看的节目的标识、 优化连接的标识和客户端的标识。  After the client device obtains the identity of the proxy device sent by the server, it can send a data request for requesting program data to the proxy device. The data request includes an identifier of a program requested by the client device and an identifier of the client. In the case that the server sends the identifier of the optimized connection to the client device, the data request may also include the identifier of the optimized connection and the identifier of the client, or the identifier of the program requested by the client device, the identifier of the optimized connection, and the client. The identity of the end.
代理设备上建立第三对应关系。第三对应关系也可以以对应关系表的形式 保存, 称为第三对应关系表, 如表 3所示。 第三对应关系中至少保存优化连接 的标识和客户端设备的标识的对应关系。代理设备可以根据隧道指定消息或者 数据请求建立第三对应关系。 例如,在隧道指定消息中包括客户端设备的标识 的情况下,代理设备在接收到服务器发送的隧道指定消息后,根据隧道指定消 息中的客户端设备的标识以及根据该隧道指定消息建立或利用的优化连接的 标识建立第三对应关系。 又如, 在数据请求中包括优化连接的标识的情况下, 代理设备在接收到数据请求后,根据数据请求中的客户端设备的标识以及优化 连接的标识建立第三对应关系。如果第三对应关系已存在, 则根据该优化连接 的标识与客户端设备的标识更新第三对应关系,即如果该优化连接的标识与客 户端设备的标识的对应关系不在第三对应关系中, 则将其加入第三对应关系 中。  A third correspondence is established on the proxy device. The third correspondence may also be saved in the form of a correspondence table, which is referred to as a third correspondence table, as shown in Table 3. The third correspondence corresponds to at least the correspondence between the identifier of the optimized connection and the identifier of the client device. The proxy device can establish a third correspondence according to the tunnel designation message or the data request. For example, if the identifier of the client device is included in the tunnel designation message, after receiving the tunnel designation message sent by the server, the proxy device establishes or utilizes the identifier of the client device according to the tunnel designation message according to the tunnel designation message. The identifier of the optimized connection establishes a third correspondence. For another example, if the identifier of the optimized connection is included in the data request, after receiving the data request, the proxy device establishes a third correspondence according to the identifier of the client device in the data request and the identifier of the optimized connection. If the third correspondence is already existing, the third correspondence is updated according to the identifier of the optimized connection and the identifier of the client device, that is, if the correspondence between the identifier of the optimized connection and the identifier of the client device is not in the third correspondence, Then add it to the third correspondence.
表 3  table 3
优化连接的标识 客户端设备的标识  Optimize the identity of the connection The identity of the client device
101 192.168.1.8  101 192.168.1.8
192.168.1.95  192.168.1.95
102  102
192.168.1.77  192.168.1.77
103 192.168.1.34  103 192.168.1.34
104 192.168.1.55  104 192.168.1.55
第三对应关系中也可以包括节目的标识,以第三对应关系表的形式保存的 第三对应关系如表 4所示。 代理设备可以根据隧道指定消息或者数据请求建立 第三对应关系,或者根据隧道指定消息和数据请求建立包括节目的标识的第三 对应关系。例如,在隧道指定消息中包括客户端设备请求收看的节目的标识和 客户端设备的标识的情况下, 代理设备在接收到服务器发送的隧道指定消息 后,根据隧道指定消息中的客户端设备请求收看的节目的标识、客户端设备的 标识以及根据该隧道指定消息建立或利用的优化连接的标识建立第三对应关 系。 又如, 在数据请求中包括客户端设备请求收看的节目的标识、 优化连接的 标识和客户端的标识的情况下,代理设备在接收到数据请求后,根据数据请求 中的节目的标识、 优化连接的标识和客户端的标识建立第三对应关系。 此外, 代理设备也可以从隧道指定消息获取节目的标识和优化连接的标识的对应关 系,从数据请求获取节目的标识和客户端设备的标识的对应关系或者优化连接 的标识和客户端设备的标识的对应关系,从而建立第三对应关系。也可以从隧 道指定消息获取客户端设备的标识和优化连接的标识的对应关系,从数据请求 获取节目的标识和客户端设备的标识的对应关系,从而建立第三对应关系。如 果所述第二对应关系和第三对应关系都是根据隧道指定消息建立的,则所述第 二对应关系和第三对应关系的内容可以相同, 或者可以是同一对应关系。 The third correspondence may also include an identifier of the program, which is saved in the form of a third correspondence table. The third correspondence is shown in Table 4. The proxy device may establish a third correspondence according to the tunnel designation message or the data request, or establish a third correspondence including the identifier of the program according to the tunnel designation message and the data request. For example, if the tunnel designation message includes the identifier of the program requested by the client device and the identifier of the client device, after receiving the tunnel designation message sent by the server, the proxy device requests the client device according to the tunnel designation message. The identifier of the program being watched, the identifier of the client device, and the identifier of the optimized connection established or utilized according to the tunnel designation message establish a third correspondence. For example, in the case that the data request includes the identifier of the program requested by the client device, the identifier of the optimized connection, and the identifier of the client, after receiving the data request, the proxy device optimizes the connection according to the identifier of the program in the data request. The identifier of the client establishes a third correspondence with the identifier of the client. In addition, the proxy device may obtain the correspondence between the identifier of the program and the identifier of the optimized connection from the tunnel designation message, obtain the correspondence between the identifier of the program and the identifier of the client device from the data request, or optimize the identifier of the connection and the identifier of the client device. Correspondence relationship, thereby establishing a third correspondence. The corresponding relationship between the identifier of the client device and the identifier of the optimized connection may be obtained from the tunnel designation message, and the correspondence between the identifier of the program and the identifier of the client device is obtained from the data request, thereby establishing a third correspondence. If the second correspondence and the third correspondence are both established according to the tunnel designation message, the content of the second correspondence and the third correspondence may be the same, or may be the same correspondence.
表 4  Table 4
节目的标识 优化连接的标识 客户端设备的标识  Identification of the program ID of the optimized connection Identification of the client device
CCTV1 101 192.168.1.8  CCTV1 101 192.168.1.8
192.168.1.95  192.168.1.95
CCTV4 102  CCTV4 102
192.168.1.77  192.168.1.77
103 192.168.1.34  103 192.168.1.34
CCTV6  CCTV6
104 192.168.1.55  104 192.168.1.55
代理设备收到客户端设备发送的数据请求后,可以直接将数据请求转发给 服务器; 如果代理设备具备汇聚功能, 也可以将多个客户端设备发送的第二数 据请求, 汇聚成一个第一数据请求发送给服务器。所说的汇聚功能可以是实时 流传输协议定义的汇聚(multiplexing )功能, 具体可以是将多个请求收看不同 节目的第二数据请求打包进一个第一数据请求中,或者是将多个请求收看相同 节目的第二数据请求抑制成一个第一数据请求。所说的抑制是指只保留一个第 二数据请求, 忽略其它请求收看收看相同节目的第二数据请求,将该保留的第 二数据请求作为第一数据请求。 After receiving the data request sent by the client device, the proxy device may directly forward the data request to the server. If the proxy device has the aggregation function, the second data request sent by the multiple client devices may be aggregated into one first data. The request is sent to the server. The aggregation function may be a multiplexing function defined by a real-time streaming protocol, and may specifically be to package multiple second data requests for requesting different programs into one first data request, or to view multiple requests. The second data request of the same program is suppressed into a first data request. The suppression means that only one is retained. The second data request ignores other requests for the second data to view the same program, and the reserved second data request is used as the first data request.
服务器根据收到的数据请求中包括的节目的标识生成该节目的响应数据, 并根据第一对应关系获取该节目对应的优化连接,将该节目的响应数据通过该 节目对应的优化连接发送给代理设备。如果服务器收到的数据请求中包括多个 节目的标识, 服务器将生成多个响应数据, 即, 针对每个节目生成一个响应数 据; 然后服务器查询第一对应关系获取每个节目的优化连接,将不同节目的响 应数据通过各自对应的优化连接发送给代理设备。  The server generates response data of the program according to the identifier of the program included in the received data request, and obtains an optimized connection corresponding to the program according to the first correspondence, and sends the response data of the program to the proxy through the optimized connection corresponding to the program. device. If the data request received by the server includes the identifiers of the plurality of programs, the server generates multiple response data, that is, generates one response data for each program; then the server queries the first correspondence to obtain an optimized connection for each program, and Response data for different programs is sent to the proxy device via their respective optimized connections.
代理设备收到服务器通过优化连接发送的响应数据后, 需要采用 HTTP协 议对该响应数据进行外层封装后, 才能通过 HTTP连接将封装后的响应数据发 送给客户端设备。 具体的, 代理设备收到服务器通过优化连接例如 101发送的 响应数据后, 先采用 HTTP协议对该响应数据进行外层封装, 再查询第第三对 应关系得到该优化连接 101对应的客户端设备的标识, 将该封装后的响应数据 发送给查询得到的客户端设备; 如果查询得知对应的客户端设备有多个, 则将 该封装后的响应数据按照对应的客户端设备的数量复制成多份,分别发送给对 应的多个客户端设备。  After receiving the response data sent by the server through the optimized connection, the proxy device needs to use the HTTP protocol to encapsulate the response data before sending the encapsulated response data to the client device through the HTTP connection. Specifically, after receiving the response data sent by the server through the optimized connection, for example, the proxy device, the proxy device performs external encapsulation on the response data by using the HTTP protocol, and then queries the third corresponding relationship to obtain the client device corresponding to the optimized connection 101. The identifier, the encapsulated response data is sent to the client device obtained by the query; if the query is that the corresponding client device has multiple, the encapsulated response data is copied into the number according to the corresponding client device. The copies are sent to the corresponding multiple client devices.
客户端设备收到的数据将是以嵌入协议作为内层封装协议、 以 HTTP协议 作为外层封装协议进行双层封装的数据。其中, 所说内层嵌入协议是客户端支 持的嵌入协议。 从而, 客户端设备可以解析收到的数据, 正常收看节目。  The data received by the client device will be double-encapsulated with the embedded protocol as the inner layer encapsulation protocol and the HTTP protocol as the outer encapsulation protocol. The inner embedding protocol is an embedded protocol supported by the client. Thus, the client device can parse the received data and watch the program normally.
综上, 本发明实例提供的数据传输方法, 一方面, 代理设备是由服务器指 定的, 在指定的代理设备故障时, 服务器可以更改指定的代理设备, 与更改后 的代理设备建立优化连接进而与客户端进行数据交互,从而,保障客户端与服 务器之间的数据传输不至于中断; 另一方面,在服务器和代理设备之间采用客 户端支持的嵌入协议建立起优化连接,通过该优化连接传输客户端设备通过代 理设备发送的数据请求和服务器返回的响应数据, 相对于现有技术中的 HTTP 连接传输数据, 可以具有更优的传输效率, 因而可以减轻服务器的压力, 特别 是直播场景下并发用户请求对服务器造成的压力。 另外,如果代理设备具备汇 聚功能,通过将多个数据请求汇聚成一个, 可以进一步减少代理设备和服务器 之间的流量带宽, 节约资源, 减轻服务器的负担。 连接的步骤。 In summary, the data transmission method provided by the example of the present invention, on the one hand, the proxy device is specified by the server, and when the designated proxy device fails, the server can change the designated proxy device, and establish an optimized connection with the changed proxy device. The client performs data interaction, so as to ensure that the data transmission between the client and the server is not interrupted; on the other hand, an optimized connection is established between the server and the proxy device by using an embedded protocol supported by the client, and the optimized connection is transmitted through the connection. The data request sent by the client device through the proxy device and the response data returned by the server may have better transmission efficiency than the HTTP connection transmission data in the prior art, thereby reducing the pressure on the server, especially in the live broadcast scenario. User requests pressure on the server. In addition, if the proxy device has an aggregation function, by aggregating multiple data requests into one, the traffic bandwidth between the proxy device and the server can be further reduced, resources are saved, and the burden on the server is reduced. The steps to connect.
如果有客户端设备停止收看节目,该客户端设备可以向代理设备发送断开 请求以告知代理设备已经停止收看节目,该断开请求中包括该客户端设备停止 收看的节目的标识以及客户端设备的标识。客户端设备也可以在停止收看节目 时不发送断开请求告知代理设备, 则代理设备需要通过预设的机制, 例如超时 机制, 来感知客户端设备是否已经停止收看节目。代理设备得知客户端设备停 止收看节目后, 将停止收看节目的客户端设备的标识从第三对应关系中删除。  If there is a client device stopping watching the program, the client device may send a disconnect request to the proxy device to inform the proxy device that the program has stopped watching, the disconnect request includes an identifier of the program that the client device stops watching, and the client device Logo. The client device can also notify the proxy device not to send a disconnect request when stopping watching the program, and the proxy device needs to use a preset mechanism, such as a timeout mechanism, to sense whether the client device has stopped watching the program. After the agent device knows that the client device stops watching the program, the identifier of the client device that stops watching the program is deleted from the third correspondence.
如果代理设备的第二对应关系中保存有客户端标识,也需要将停止收看节 目的客户端设备的标识从所说的第二对应关系中删除。服务器建立的第一对应 关系中如果保存有客户端标识,则代理设备在更新自己保存的第二对应关系之 后还要可以知服务器, 以便服务器更新自己保存的第一对应关系,将停止收看 节目的客户端设备的标识从所说的第一对应关系中删除。  If the client identifier is stored in the second correspondence of the proxy device, the identifier of the client device that stops watching the program needs to be deleted from the second correspondence. If the client identifier is saved in the first correspondence established by the server, the proxy device may also know the server after updating the second correspondence saved by the server, so that the server updates the first correspondence saved by itself, and stops watching the program. The identity of the client device is removed from the first correspondence.
当第三对应关系中某个优化连接对应的所有客户端设备都停止收看对应 的节目后, 可以将该优化连接拆除。 该拆除连接的操作可以由代理设备发起。 服务器建立的第一对应关系如果保存有客户端标识,该拆除连接的操作也可以 由服务器发起。  After all the client devices corresponding to an optimized connection in the third correspondence stop watching the corresponding program, the optimized connection may be removed. The operation of tearing down the connection can be initiated by the proxy device. If the first correspondence established by the server holds the client identifier, the operation of tearing down the connection may also be initiated by the server.
通过将不使用的优化连接及时拆除, 可以释放资源, 进一步减轻服务器的 负担。  By dismantling the unused connections that are not used in time, resources can be released, further reducing the burden on the server.
请参考图 2, 本发明实施例提供一种数据传输方法, 包括:  Referring to FIG. 2, an embodiment of the present invention provides a data transmission method, including:
210、 代理设备将收到的客户端设备发送的数据请求转发给服务器。  210. The proxy device forwards the received data request sent by the client device to the server.
本实施例中,代理设备和服务器预先已建立好优化连接, 该优化连接是采 用客户端设备支持的嵌入协议建立的, 该嵌入协议是比 HTTP具有更优传输效 率的协议, 具体可以 WebSocket协议或者多播协议。 代理设备和服务器建立优 化连接的步骤可以包括:  In this embodiment, the proxy device and the server have established an optimized connection in advance, and the optimized connection is established by using an embedded protocol supported by the client device, and the embedded protocol is a protocol with better transmission efficiency than HTTP, and specifically may be a WebSocket protocol or Multicast protocol. The steps for the proxy device and the server to establish an optimized connection may include:
a、 代理设备接收所述服务器发送的隧道指定消息, 所述隧道指定消息中 携带所述客户端设备支持的嵌入协议和所述客户端设备请求收看的节目的标 识。  The proxy device receives the tunnel designation message sent by the server, where the tunnel designation message carries the embedded protocol supported by the client device and the identifier of the program requested by the client device.
b、 采用所述客户端设备支持的嵌入协议与所述服务器建立优化连接。 举例来说,该优化连接可以是: WebSocket连接,或者 RTSP连接,或者 RTP 连接。代理设备可以发送隧道指定成功响应给服务器, 以表示优化连接已建立 成功。 优化连接已建立成功后, 代理设备可以建立并保存第二对应关系, 所述 第二对应关系中至少包括:所述客户端设备请求收看的节目和所述优化连接的 对应关系。如果第二对应关系已存在, 则根据该优化连接的标识与隧道指定消 息中包括的客户端设备请求收看的节目的标识更新第二对应关系,即如果该优 化连接的标识与客户端设备请求收看的节目的标识的对应关系不在第二对应 关系中, 则将其加入第二对应关系中。 第二对应关系具体可以是对应关系表的 形式, 如图 1所示。 b. Establish an optimized connection with the server by using an embedded protocol supported by the client device. For example, the optimized connection can be: a WebSocket connection, or an RTSP connection, or an RTP connection. The proxy device can send a tunnel specifying a successful response to the server to indicate that the optimized connection has been established successfully. After the optimized connection has been successfully established, the proxy device may establish and save a second correspondence, where the second correspondence includes at least: a correspondence between the program requested by the client device and the optimized connection. If the second correspondence exists, the second correspondence is updated according to the identifier of the optimized connection and the identifier of the program requested by the client device included in the tunnel designation message, that is, if the identifier of the optimized connection and the client device request to view The correspondence of the identifiers of the programs is not in the second correspondence, and is added to the second correspondence. The second correspondence may specifically be in the form of a correspondence table, as shown in FIG. 1 .
代理设备收到隧道指定消息后, 与服务器建立优化连接之前, 可以查询第 二对应关系中是否已经存在所述节目的优化连接,如果不存在,说明尚未建立 该节目的优化连接, 则代理设备与服务器才建立该节目的优化连接。如果查询 发现已经存在所述节目的优化连接,则代理设备与服务器可以不再建立新的优 化连接, 而是利用已建立的该节目的优化连接。  After receiving the tunnel designation message, the proxy device may query whether the optimized connection of the program already exists in the second correspondence relationship before establishing the optimized connection with the server. If not, it indicates that the optimized connection of the program has not been established yet, and the proxy device and the proxy device The server establishes an optimized connection for the program. If the query finds that an optimized connection for the program already exists, the proxy device and the server may no longer establish a new optimized connection, but instead utilize the established optimized connection of the program.
优化连接建立成功后, 服务器会将该代理设备的标识发送给客户端设备, 以指示客户端设备将用于请求节目数据的数据请求发送给该指定的代理设备。 代理设备收到客户端设备发送的数据请求后,可以直接将数据请求转发给服务 器; 如果代理设备具备汇聚功能,也可以将多个客户端设备发送的第二数据请 求, 汇聚成一个第一数据请求发送给服务器。所说的汇聚功能可以是实时流传 输协议定义的汇聚(multiplexing )功能, 具体可以是将多个请求收看不同节目 的第二数据请求打包进一个第一数据请求中,或者是将多个请求收看相同节目 的第二数据请求抑制成一个第一数据请求。所说的抑制是指只保留一个第二数 据请求, 忽略其它请求收看收看相同节目的第二数据请求,将该保留的第二数 据请求作为第一数据请求。  After the optimized connection is successfully established, the server sends the identifier of the proxy device to the client device to instruct the client device to send a data request for requesting program data to the designated proxy device. After receiving the data request sent by the client device, the proxy device may directly forward the data request to the server. If the proxy device has the aggregation function, the second data request sent by the multiple client devices may be aggregated into one first data. The request is sent to the server. The aggregation function may be a multiplexing function defined by a real-time streaming protocol, and may specifically be to package multiple second data requests for requesting different programs into one first data request, or to view multiple requests. The second data request of the same program is suppressed into a first data request. The suppression means that only one second data request is reserved, and other second data requests for viewing the same program are ignored, and the retained second data request is used as the first data request.
代理设备收到数据请求转发给所述服务器之前,还可以建立并保存第三对 应关系。第三对应关系也可以以对应关系表的形式保存,称为第三对应关系表, 如表 3所示。 第三对应关系中至少保存优化连接的标识和客户端设备的标识的 对应关系。如果第三对应关系已存在, 则根据该优化连接的标识与客户端设备 的标识更新第三对应关系,即如果该优化连接的标识与客户端设备的标识的对 应关系不在第三对应关系中, 则将其加入第三对应关系中。 Before the proxy device receives the data request and forwards it to the server, the third correspondence may also be established and saved. The third correspondence may also be saved in the form of a correspondence table, which is referred to as a third correspondence table, as shown in Table 3. The third correspondence corresponds to at least the correspondence between the identifier of the optimized connection and the identifier of the client device. If the third correspondence exists, the third correspondence is updated according to the identifier of the optimized connection and the identifier of the client device, that is, if the identifier of the optimized connection and the identifier of the client device are If the relationship is not in the third correspondence, it is added to the third correspondence.
220、 所述代理设备接收所述服务器通过已建立的优化连接发送的响应数 据,所述优化连接是所述代理设备与所述服务器采用所述客户端设备支持的嵌 入协议建立的, 所述响应数据是基于所述嵌入协议的响应数据。  220. The proxy device receives response data sent by the server through an established optimized connection, where the optimized connection is established by the proxy device and the server using an embedded protocol supported by the client device, and the response is The data is based on the response data of the embedded protocol.
代理设备接收服务器发送的响应数据。该响应数据是服务器根据数据请求 中包括的节目的标识生成的,针对每个节目生成一个响应数据。服务器生成响 应数据后,通过查询第一对应关系获取每个节目的优化连接,将不同节目的响 应数据通过各自对应的优化连接发送给代理设备。所说的优化连接是代理设备 与服务器采用客户端设备支持的嵌入协议建立的。所说的响应数据则是基于所 述嵌入协议的响应数据, 即, 采用所述嵌入协议的响应数据。  The proxy device receives the response data sent by the server. The response data is generated by the server based on the identification of the program included in the data request, and a response data is generated for each program. After the server generates the response data, the optimized connection of each program is obtained by querying the first correspondence, and the response data of the different programs is sent to the proxy device through the corresponding optimized connection. The optimized connection is established by the proxy device and the server using an embedded protocol supported by the client device. The response data is based on response data of the embedded protocol, i.e., response data using the embedded protocol.
230、 所述代理设备采用超文本传输协议将所述响应数据进行外层封装后 发送给所述客户端设备。  230. The proxy device performs outer layer encapsulation on the response data by using a hypertext transfer protocol, and sends the response data to the client device.
代理设备收到服务器通过优化连接发送的响应数据后, 需要采用 HTTP协 议对该响应数据进行外层封装后, 才能通过 HTTP连接将封装后的响应数据发 送给客户端设备。具体的,代理设备收到服务器通过优化连接发送的响应数据 后, 可以从保存的第三对应关系中查询所述优化连接对应的客户端设备,将采 用 HTTP进行了外层封装的响应数据发送给查询到的客户端设备。  After receiving the response data sent by the server through the optimized connection, the proxy device needs to use the HTTP protocol to encapsulate the response data before sending the encapsulated response data to the client device through the HTTP connection. Specifically, after receiving the response data sent by the server through the optimized connection, the proxy device may query the client device corresponding to the optimized connection from the saved third correspondence, and send the response data of the outer package by using HTTP. Queryed client device.
客户端设备收到的数据将是以嵌入协议作为内层封装协议、 以 HTTP协议 作为外层封装协议进行双层封装的数据。其中, 所说内层嵌入协议是客户端支 持的嵌入协议。 从而, 客户端设备可以解析收到的数据, 正常收看节目。  The data received by the client device will be double-encapsulated with the embedded protocol as the inner layer encapsulation protocol and the HTTP protocol as the outer encapsulation protocol. The inner embedding protocol is an embedded protocol supported by the client. Thus, the client device can parse the received data and watch the program normally.
综上, 本发明实例提供的数据传输方法, 在服务器和代理设备之间采用客 户端支持的嵌入协议建立起优化连接,通过该优化连接传输客户端设备通过代 理设备发送的数据请求和服务器返回的响应数据, 相对于现有技术中的 HTTP 连接传输数据, 可以具有更优的传输效率, 因而可以减轻服务器的压力, 特别 是直播场景下并发用户请求对服务器造成的压力。 另外,如果代理设备具备汇 聚功能,通过将多个数据请求汇聚成一个, 可以进一步减少代理设备和服务器 之间的流量带宽, 节约资源, 减轻服务器的负担。  In summary, the data transmission method provided by the example of the present invention establishes an optimized connection between the server and the proxy device by using an embedded protocol supported by the client, and transmits the data request sent by the client device through the proxy device and the server returns through the optimized connection. The response data can transmit data with respect to the HTTP connection in the prior art, and can have better transmission efficiency, thereby reducing the pressure on the server, especially the concurrent user requesting pressure on the server in the live broadcast scenario. In addition, if the proxy device has an aggregation function, by aggregating multiple data requests into one, the traffic bandwidth between the proxy device and the server can be further reduced, resources are saved, and the burden on the server is reduced.
请参考图 3所示的应用场景例, 涉及的设备包括三个客户端设备 301、 302 和 303,—个无隧道功能的代理设备 304,—个具有隧道封装功能的代理设备 305 和服务器 306。 客户端设备 301、 302和 303支持相同的嵌入协议例如 RTP, 可以 是三个分别装有某个嵌入协议插件的 IE ( Internet Explorer )客户端设备。 代理 设备 304无隧道封装功能, 仅仅作为普通代理, 提供转发的功能。 代理设备 305 具有隧道封装功能,还具有汇聚客户端设备发送的数据请求的功能, 可以将多 个客户端设备发送的数据请求汇聚成一个。 服务器 306可以是 web服务器。 Referring to the application scenario shown in FIG. 3, the device involved includes three client devices 301, 302, and 303, a proxy device 304 without tunnel function, and a proxy device 305 having a tunnel encapsulation function. And server 306. Client devices 301, 302, and 303 support the same embedding protocol, such as RTP, and may be three IE (Internet Explorer) client devices that each have an embedded protocol plug-in installed. The proxy device 304 has no tunnel encapsulation function and only provides a forwarding function as a general proxy. The proxy device 305 has a tunnel encapsulation function and also has the function of aggregating data requests sent by the client device, and can aggregate data requests sent by multiple client devices into one. Server 306 can be a web server.
本应用场景例包括:  Examples of this application scenario include:
客户端设备 301和 302均向服务器 306发起隧道协商请求, 每个客户端设备 发送的隧道协商请求中携带了该客户端设备支持的嵌入协议的标识和该客户 端设备请求收看的节目的标识,还可以包括该客户端设备的标识。 隧道协商请 求经过代理设备 304, 转发给服务器 306。 服务器 306收到隧道协商请求后, 识 别客户端设备支持的嵌入协议。 如果服务器 306不能识别客户端设备 301和 302 支持的嵌入协议, 则向客户端设备 301和 302发出错误响应,指示客户端设备隧 道协商不成功。 如果服务器 306能够支持识别出的嵌入协议, 从中选择一种嵌 入协议, 以便和指定的代理设备采用该选择的嵌入协议建立优化连接。  The client devices 301 and 302 both initiate a tunnel negotiation request to the server 306, and the tunnel negotiation request sent by each client device carries the identifier of the embedded protocol supported by the client device and the identifier of the program requested by the client device. It can also include the identity of the client device. The tunnel negotiation request passes through the proxy device 304 and is forwarded to the server 306. After receiving the tunnel negotiation request, the server 306 identifies the embedded protocol supported by the client device. If the server 306 does not recognize the embedded protocol supported by the client devices 301 and 302, an error response is sent to the client devices 301 and 302 indicating that the client device tunnel negotiation was unsuccessful. If the server 306 is capable of supporting the identified embedding protocol, an embedding protocol is selected therefrom to establish an optimized connection with the designated proxy device using the selected embedding protocol.
服务器 306选择完嵌入协议后, 根据预定策略指定具有隧道功能的代理设 备 305 ,发送隧道指定消息给代理设备 305。 隧道指定消息中包括所选择的协议 的标识、请求收看的节目的标识,还可以包括客户端设备的标识。代理设备 305 接收到隧道指定消息后,先判断是否支持服务器选择的嵌入协议,如果不支持, 代理设备 305向服务器 306发送错误响应, 服务器 306收到错误响应后, 也会向 客户端设备 301和 302发出错误响应, 指示隧道协商不成功; 如果代理设备 305 支持服务器选择的嵌入协议,代理设备 305与服务器 306采用该嵌入协议建立优 化连接。 然后服务器和代理设备各自建立并保存该优化连接与客户端设备 301 与 302请求收看的节目的对应关系, 服务器建立的该对应关系称为第一对应关 系,代理设备建立的该对应关系称为第二对应关系。代理设备 305向服务器 306 发送隧道指定成功响应,表明代理设备 305和服务器 306之间的隧道协商和建立 成功。  After the server 306 selects the embedded protocol, the proxy device 305 having the tunnel function is specified according to the predetermined policy, and the tunnel designation message is sent to the proxy device 305. The tunnel designation message includes an identifier of the selected protocol, an identifier of the program requested to be viewed, and may also include an identifier of the client device. After receiving the tunnel designation message, the proxy device 305 first determines whether the embedded protocol selected by the server is supported. If not, the proxy device 305 sends an error response to the server 306, and after receiving the error response, the server 306 also sends the error to the client device 301. 302 issues an error response indicating that the tunnel negotiation was unsuccessful; if the proxy device 305 supports the embedded protocol selected by the server, the proxy device 305 and the server 306 employ the embedded protocol to establish an optimized connection. Then, the server and the proxy device respectively establish and save the corresponding relationship between the optimized connection and the program requested by the client devices 301 and 302. The corresponding relationship established by the server is referred to as a first correspondence, and the corresponding relationship established by the proxy device is called The second correspondence. The proxy device 305 sends a tunnel designation success response to the server 306 indicating that the tunnel negotiation and establishment between the proxy device 305 and the server 306 was successful.
服务器 306收到代理设备 305发送的隧道指定成功响应后, 将代理设备 305 的标识发送给客户端设备 301和 302, 以通知客户端设备 301和 302将数据请求 发 .送个代理设备 305。 其中, 服务器可以将代理设备 305的标识携带在隧道协 商成功响应发送给客户端设备 301和 302。 至此, 隧道协商成功。 After receiving the tunnel designation success response sent by the proxy device 305, the server 306 sends the identifier of the proxy device 305 to the client devices 301 and 302 to notify the client devices 301 and 302 to send the data request to the proxy device 305. Wherein, the server may carry the identifier of the proxy device 305 in the tunnel association The quotient success response is sent to client devices 301 and 302. At this point, the tunnel negotiation is successful.
客户端设备 301和 302并发向代理设备 305发送数据请求, 例如数据传送 ( data transfer )请求。 代理设备 305将收到的多个数据请求汇聚成一个, 例如 汇聚的数据请求(bulk data req ), 转发给服务器。 代理设备 305还建立起第三 对应关系,第三对应关系中包括客户端设备和优化连接的对应关系。服务器 106 对代理设备发送的数据请求进行响应, 生成每个节目的响应数据 (response data ), 将每个节目的响应数据通过各个节目的优化连接给代理设备 305。 代理 设备 305用 HTTP对响应数据进行外层封装后,从第三对应关系中查询该优化连 接对应的客户端设备为 301和 302, 然后将封装后的响应数据复制为 2份, 分别 发送给客户端设备 301和 302。  Client devices 301 and 302 concurrently send data requests, such as data transfer requests, to proxy device 305. The proxy device 305 aggregates the received multiple data requests into one, such as a bulk data req, forwarded to the server. The proxy device 305 also establishes a third correspondence, which includes the correspondence between the client device and the optimized connection. The server 106 responds to the data request sent by the proxy device, generates response data for each program, and connects the response data for each program to the proxy device 305 through the optimization of each program. After the proxy device 305 externally encapsulates the response data, the client device corresponding to the optimized connection is 301 and 302 from the third correspondence, and then the encapsulated response data is copied into two copies and sent to the client respectively. End devices 301 and 302.
如果新的客户端设备 303向服务器 306发送隧道协商请求。 服务器 306收到 隧道协商请求后, 也选择了相同的嵌入协议, 并指定了代理设备 305 , 然后向 代理设备 305发送隧道指定消息。代理设备 305收到隧道指定消息后,从第二对 应关系发现客户端设备 303请求收看的节目对应的优化连接已经建立, 则不必 再建立新的组播连接, 向服务器 306回应连接通道更新消息。服务器 306收到该 连接通道更新消息后给客户端设备 303发送隧道协商成功响应。客户端设备 303 收到隧道协商成功响应后, 向代理设备 305发送数据请求, 以获取请求收看的 节目的数据。 代理设备更新第三对应关系, 加入客户端设备 303的标识。  If the new client device 303 sends a tunnel negotiation request to the server 306. After receiving the tunnel negotiation request, the server 306 also selects the same embedded protocol, specifies the proxy device 305, and then sends a tunnel designation message to the proxy device 305. After receiving the tunnel designation message, the proxy device 305 detects that the optimized connection corresponding to the program requested by the client device 303 has been established from the second corresponding relationship, and does not need to establish a new multicast connection, and responds to the server 306 with the connection channel update message. After receiving the connection channel update message, the server 306 sends a tunnel negotiation success response to the client device 303. After receiving the tunnel negotiation success response, the client device 303 sends a data request to the proxy device 305 to obtain the data of the program requested to be viewed. The proxy device updates the third correspondence and adds the identity of the client device 303.
假定客户端设备 301停止收看节目, 则发送断开请求( disconnection req ) 给代理设备 305 , 该断开请求中携带节目的标识和客户端设备的标识等信息; 当然,客户端设备 301停止收看节目时也可以不通知代理设备 305 , 此时代理设 备 305通过预设的机制(比如说超时等 )感知客户端设备 301是否已经停止收看 节目。代理设备 305获知客户端设备 301已经停止收看节目后, 更新自己保存的 第三对应关系, 同时可以向服务器 306发出一个连接通道更新消息, 通知服务 器该客户端设备已经离线, 以便服务器要对该客户端设备做些别的业务, 比如 统计等。服务器 306收到连接通道更新消息后, 向代理设备 305回应连接通道更 新响应。如果客户端设备 301发出过断开请求, 那么代理设备 305在更新自己保 存的第三对应关系后, 向客户端设备 301发出断开响应 ( disconnection ack )。  Assuming that the client device 301 stops watching the program, a disconnection req is sent to the proxy device 305, which carries information such as the identifier of the program and the identifier of the client device; of course, the client device 301 stops watching the program. The proxy device 305 may also be not notified. At this time, the proxy device 305 senses whether the client device 301 has stopped watching the program through a preset mechanism (such as timeout or the like). After the proxy device 305 knows that the client device 301 has stopped watching the program, it updates its saved third correspondence, and can send a connection channel update message to the server 306, notifying the server that the client device is offline, so that the server wants the client. The end device does some other services, such as statistics. Upon receipt of the connection channel update message, server 306 responds to proxy device 305 with a connection channel update response. If the client device 301 issues a disconnect request, the proxy device 305 issues a disconnection ack to the client device 301 after updating its saved third correspondence.
当代理设备 305保存的第三对应关系中某个优化连接对应的客户端设备全 部停止收看对应的节目时, 该优化连接需要进行拆除, 以释放资源。 该拆除操 作可以由代理设备 305发起, 也可以由服务器 306发起。 When the proxy device 305 saves the third correspondence, the client device corresponding to an optimized connection is all When the department stops watching the corresponding program, the optimized connection needs to be dismantled to release resources. This teardown operation may be initiated by proxy device 305 or may be initiated by server 306.
请参考图 4, 本发明实施例提供一种服务器, 包括:  Referring to FIG. 4, an embodiment of the present invention provides a server, including:
获取模块 410, 用于获取客户端设备支持的嵌入协议;  The obtaining module 410 is configured to obtain an embedded protocol supported by the client device.
连接建立模块 420, 用于指定一个代理设备, 采用所述客户端设备支持的 嵌入协议, 建立连接到所述代理设备的优化连接;  a connection establishing module 420, configured to specify a proxy device, and establish an optimized connection connected to the proxy device by using an embedded protocol supported by the client device;
接收模块 430, 用于接收所述代理设备转发的, 来自于所述客户端设备的 数据请求;  The receiving module 430 is configured to receive, by the proxy device, a data request from the client device.
响应模块 440, 用于生成基于所述嵌入协议的响应数据, 将所述响应数据 通过所述优化连接发送给所述代理设备,以便所述代理设备采用超文本传输协 议将所述响应数据进行外层封装后发送给所述客户端设备。  The response module 440 is configured to generate response data based on the embedded protocol, and send the response data to the proxy device by using the optimized connection, so that the proxy device performs the response data by using a hypertext transfer protocol. The layer is encapsulated and sent to the client device.
进一步的, 所述获取模块 410, 具体可以用于接收所述客户端设备发送的 隧道协商请求,所述隧道协商请求中包括客户端设备支持的嵌入协议的标识与 客户端设备请求收看的节目的标识, 所述嵌入协议包括 WebSocket协议和 /或多 播协议。  Further, the acquiring module 410 is specifically configured to receive a tunnel negotiation request sent by the client device, where the tunnel negotiation request includes an identifier of an embedded protocol supported by the client device and a program requested by the client device. The embedded protocol includes a WebSocket protocol and/or a multicast protocol.
更进一步的, 服务器还可以包括: 关系建立模块, 用于在所述连接建立模 块成功建立起连接到所述代理设备的优化连接之后, 建立并保存第一对应关 系, 所述第一对应关系中至少包括: 客户端设备请求收看的节目和所述优化连 接的对应关系。  Further, the server may further include: a relationship establishing module, configured to establish and save a first correspondence after the connection establishing module successfully establishes an optimized connection connected to the proxy device, where the first correspondence is The method at least includes: a correspondence between the program requested by the client device and the optimized connection.
再进一步的, 所述响应模块 440, 具体可以用于根据所述数据请求中包括 的节目的标识生成所述节目的响应数据,根据所述第一对应关系获取所述节目 对应的优化连接,将所述节目的响应数据通过所述节目对应的优化连接发送给 所述代理设备。  Further, the response module 440 may be configured to generate response data of the program according to the identifier of the program included in the data request, and obtain an optimized connection corresponding to the program according to the first correspondence relationship, The response data of the program is sent to the proxy device via an optimized connection corresponding to the program.
又进一步的, 服务器还可以包括: 查询模块, 用于查询所述第一对应关系 中是否已经存在所述节目的优化连接;若不存在,则指示所述连接建立模块 420 建立连接到所述代理设备的优化连接; 若已经存在, 则确定采用所述已经建立 的优化连接。  Further, the server may further include: a querying module, configured to query whether an optimized connection of the program already exists in the first correspondence; if not, instructing the connection establishing module 420 to establish a connection to the proxy An optimized connection of the device; if it already exists, it is determined to adopt the established optimized connection.
还进一步的, 所述连接建立模块 420, 具体用于发送隧道指定消息给所述 代理设备, 所述隧道指定消息中携带所述客户端设备支持的嵌入协议, 以便采 用所述嵌入协议建立连接到所述代理设备的优化连接,在所述优化连接建立成 功后,服务器将所述代理设备的标识发送给所述客户端设备, 以指示所述客户 端设备将用于请求节目数据的数据请求发送给所述代理设备。 Further, the connection establishing module 420 is specifically configured to send a tunnel designation message to the proxy device, where the tunnel designation message carries an embedded protocol supported by the client device, so as to Establishing an optimized connection connected to the proxy device by using the embedded protocol, after the optimized connection is successfully established, the server sends the identifier of the proxy device to the client device to indicate that the client device is to be used A data request for requesting program data is sent to the proxy device.
所说的服务器具体可以是计算机, 包括: 中央处理器(Central Processing Unit, CPU ), 存储器、 外部连接装置等。  The server may specifically be a computer, and includes: a central processing unit (CPU), a memory, an external connection device, and the like.
本发明实施例提供的服务器, 一方面, 在指定的代理设备故障时, 服务器 可以更改指定的代理设备,与更改后的代理设备建立优化连接进而与客户端进 行数据交互, 从而, 保障客户端与服务器之间的数据传输不至于中断; 另一方 面, 可以和代理设备采用客户端支持的嵌入协议建立起优化连接,通过该优化 连接传输客户端设备通过代理设备发送的数据请求和服务器返回的响应数据, 相对于现有技术中的 HTTP连接传输数据, 可以具有更优的传输效率, 因而可 以减轻服务器的压力, 特别是直播场景下并发用户请求对服务器造成的压力。  The server provided by the embodiment of the present invention, on the one hand, when the designated proxy device fails, the server may change the designated proxy device, establish an optimized connection with the changed proxy device, and perform data interaction with the client, thereby securing the client and the client. The data transmission between the servers is not interrupted; on the other hand, an optimized connection can be established with the proxy device using the embedded protocol supported by the client, and the data request sent by the client device through the proxy device and the response returned by the server are transmitted through the optimized connection. Compared with the HTTP connection transmission data in the prior art, the data can have better transmission efficiency, thereby reducing the pressure on the server, especially the concurrent user requesting pressure on the server in the live broadcast scenario.
请参考图 5 , 本发明实施例提供一种代理设备, 该代理设备可以是一服务 器, 包括:  Referring to FIG. 5, an embodiment of the present invention provides a proxy device, where the proxy device can be a server, including:
请求转发模块 510, 用于将收到的客户端设备发送的数据请求转发给服务 器;  The request forwarding module 510 is configured to forward the data request sent by the received client device to the server;
数据接收模块 520, 用于接收所述服务器通过已建立的优化连接发送的响 应数据,所述优化连接是所述代理设备与所述服务器采用所述客户端设备支持 的嵌入协议建立的, 所述响应数据是基于所述嵌入协议的响应数据;  a data receiving module 520, configured to receive response data sent by the server through an established optimized connection, where the optimized connection is established by the proxy device and the server using an embedded protocol supported by the client device, The response data is based on response data of the embedded protocol;
数据发送模块 530, 用于采用超文本传输协议将所述响应数据进行外层封 装后发送给所述客户端设备。  The data sending module 530 is configured to send the response data to the client device by using a hypertext transfer protocol.
进一步的, 代理设备还可以包括:  Further, the proxy device may further include:
连接建立模块, 用于接收所述服务器发送的隧道指定消息, 所述隧道指定 消息中携带所述客户端设备支持的嵌入协议的标识和所述客户端设备请求收 看的节目的标识,采用所述客户端设备支持的嵌入协议与所述服务器建立优化 连接。  a connection establishing module, configured to receive a tunnel designation message sent by the server, where the tunnel designation message carries an identifier of an embedded protocol supported by the client device and an identifier of a program requested by the client device, An embedded protocol supported by the client device establishes an optimized connection with the server.
关系建立模块, 用于在所述优化连接建立成功后,根据所述优化连接和所 述隧道指定消息更新第二对应关系, 所述第二对应关系中至少包括: 所述客户 端设备请求收看的节目和所述优化连接的对应关系。 更进一步的, 代理设备还可以包括: a relationship establishing module, configured to: after the optimized connection is successfully established, update a second correspondence according to the optimized connection and the tunnel designation message, where the second correspondence includes: the client device requests to view The correspondence between the program and the optimized connection. Further, the proxy device may further include:
查询模块,用于查询所述第二对应关系中是否已经存在所述节目对应的优 化连接; 若不存在, 则指示所述连接建立模块采用所述客户端设备支持的嵌入 协议与所述服务器建立优化连接; 若已经存在, 则确定采用所述已经存在的优 化连接。  a querying module, configured to query whether the optimized connection corresponding to the program already exists in the second corresponding relationship; if not, instructing the connection establishing module to establish with the server by using an embedded protocol supported by the client device Optimize the connection; if it already exists, then determine to use the existing optimized connection.
再进一步的, 所述关系建立模块, 还可以用于在所述请求转发模块 610将 收到的客户端设备发送的数据请求转发给服务器之前,建立并保存第三对应关 系, 所述第三对应关系中至少包括: 客户端设备与优化连接的对应关系。  Further, the relationship establishing module may be further configured to: before the request forwarding module 610 forwards the received data request sent by the client device to the server, establishing and saving a third correspondence, the third correspondence The relationship includes at least: the correspondence between the client device and the optimized connection.
还进一步的, 所述数据发送模块 530, 具体可以用于从所述第三对应关系 中查询所述优化连接对应的客户端设备;将采用超文本传输协议进行了外层封 装的所述响应数据发送给所述查询到的客户端设备。  Further, the data sending module 530 may be specifically configured to query, from the third correspondence, the client device corresponding to the optimized connection; and the response data that is encapsulated by using a hypertext transfer protocol. Sended to the client device that the query is sent to.
所说的代理设备具体可以是计算机, 包括: 中央处理器(Central Processing Unit, CPU ), 存储器、 外部连接装置等。  The proxy device may specifically be a computer, and includes: a central processing unit (CPU), a memory, an external connection device, and the like.
本发明实施例提供的代理设备,可以和服务器采用客户端支持的嵌入协议 建立起优化连接,通过该优化连接传输客户端设备通过代理设备发送的数据请 求和服务器返回的响应数据, 相对于现有技术中的 HTTP连接传输数据, 可以 具有更优的传输效率, 因而可以减轻服务器的压力,特别是直播场景下并发用 户请求对服务器造成的压力。  The proxy device provided by the embodiment of the present invention may establish an optimized connection with the server using an embedded protocol supported by the client, and transmit the data request sent by the client device through the proxy device and the response data returned by the server through the optimized connection, relative to the existing The HTTP connection in the technology transmits data, which can have better transmission efficiency, and thus can alleviate the pressure on the server, especially the pressure that the concurrent users request to the server in the live broadcast scenario.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步 骤是可以通过硬件来完成,也可以通过程序指令相关的硬件来完成, 该程序可 以存储于一计算机可读存储介质中, 存储介质可以包括: 只读存储器、 随机读 取存储器、 磁盘或光盘等。  A person of ordinary skill in the art may understand that all or part of the steps of the foregoing embodiments may be completed by hardware or by hardware related to program instructions, and the program may be stored in a computer readable storage medium. The storage medium may include: a read only memory, a random read memory, a magnetic disk or an optical disk, and the like.
以上所述,仅为本发明较佳的具体实施方式,但本发明的保护范围并不局 限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可轻易 想到的变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明的保护 范围应该以权利要求的保护范围为准。  The above is only a preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of changes or within the technical scope disclosed by the present invention. Alternatives are intended to be covered by the scope of the present invention. Therefore, the scope of the invention should be determined by the scope of the claims.

Claims

权 利 要 求 Rights request
1、 一种数据传输方法, 其特征在于, 包括:  A data transmission method, comprising:
服务器获取客户端设备支持的嵌入协议;  The server obtains an embedded protocol supported by the client device;
所述服务器指定一个代理设备, 采用所述客户端设备支持的嵌入协议, 建 立连接到所述代理设备的优化连接;  The server specifies a proxy device, and establishes an optimized connection connected to the proxy device by using an embedded protocol supported by the client device;
所述服务器接收所述代理设备转发的, 来自于所述客户端设备的数据请 求;  Receiving, by the server, a data request from the client device that is forwarded by the proxy device;
所述服务器生成基于所述嵌入协议的响应数据,将所述响应数据通过所述 优化连接发送给所述代理设备,以便所述代理设备采用超文本传输协议将所述 响应数据进行外层封装后发送给所述客户端设备。  The server generates response data based on the embedded protocol, and sends the response data to the proxy device through the optimized connection, so that the proxy device encapsulates the response data by using a hypertext transfer protocol. Sent to the client device.
2、根据权利要求 1所述的方法, 其特征在于, 所述服务器获取客户端设备 支持的嵌入协议包括:  The method according to claim 1, wherein the server acquiring the embedded protocol supported by the client device comprises:
所述服务器接收所述客户端设备发送的隧道协商请求,所述隧道协商请求 中包括客户端设备支持的嵌入协议的标识与客户端设备请求收看的节目的标 识, 所述嵌入协议包括 WebSocket协议和 /或多播协议。  The server receives the tunnel negotiation request sent by the client device, where the tunnel negotiation request includes an identifier of an embedded protocol supported by the client device and an identifier of a program requested by the client device, where the embedded protocol includes a WebSocket protocol and / or multicast protocol.
3、根据权利要求 2所述的方法, 其特征在于, 所述采用所述客户端设备支 持的嵌入协议, 建立连接到指定的所述代理设备的优化连接之后还包括: 在所述优化连接建立成功后, 建立并保存第一对应关系, 所述第一对应关 系中至少包括: 客户端设备请求收看的节目和所述优化连接的对应关系。  The method according to claim 2, wherein the using the embedded protocol supported by the client device to establish an optimized connection connected to the specified proxy device further comprises: establishing the optimized connection After the success, the first correspondence is established and saved, and the first correspondence includes at least: a correspondence between the program requested by the client device and the optimized connection.
4、根据权利要求 3所述的方法, 其特征在于, 所述服务器生成基于所述嵌 入协议的响应数据,将所述响应数据通过所述优化连接发送给所述代理设备包 括:  The method according to claim 3, wherein the server generates response data based on the embedded protocol, and the response data is sent to the proxy device through the optimized connection, including:
所述服务器根据所述数据请求中包括的节目的标识生成所述节目的响应 数据;  The server generates response data of the program according to an identifier of a program included in the data request;
根据所述第一对应关系获取所述节目对应的优化连接;  Obtaining an optimized connection corresponding to the program according to the first correspondence relationship;
将所述节目的响应数据通过所述节目对应的优化连接发送给所述代理设 备。  The response data of the program is sent to the proxy device via an optimized connection corresponding to the program.
5、 根据权利要求 3或 4所述的方法, 其特征在于, 所述建立连接到所述代 理设备的优化连接之前还包括: 查询所述第一对应关系中是否已经存在所述节目的优化连接; 若不存在, 则执行所述建立连接到所述代理设备的优化连接的步骤; 若已经存在, 则确定采用所述已经建立的优化连接。 The method according to claim 3 or 4, wherein before the establishing an optimized connection to the proxy device, the method further comprises: Querying whether the optimized connection of the program already exists in the first correspondence relationship; if not, performing the step of establishing an optimized connection connected to the proxy device; if yes, determining to adopt the established connection Optimized connection.
6、 根据权利要求 1至 5中任一项所述的方法, 其特征在于, 所述采用所述 客户端设备支持的嵌入协议, 建立连接到所述代理设备的优化连接包括: 所述服务器发送隧道指定消息给所述代理设备,所述隧道指定消息中携带 所述客户端设备支持的嵌入协议,以便采用所述嵌入协议建立连接到所述代理 设备的优化连接;  The method according to any one of claims 1 to 5, wherein the establishing an optimized connection connected to the proxy device by using an embedded protocol supported by the client device comprises: sending, by the server The tunnel designation message is sent to the proxy device, where the tunnel designation message carries an embedded protocol supported by the client device, so as to establish an optimized connection connected to the proxy device by using the embedded protocol;
在所述优化连接建立成功后,服务器将所述代理设备的标识发送给所述客 户端设备,以指示所述客户端设备将用于请求节目数据的数据请求发送给所述 代理设备。  After the optimized connection is successfully established, the server sends the identifier of the proxy device to the client device to instruct the client device to send a data request for requesting program data to the proxy device.
7、 一种数据传输方法, 其特征在于, 包括:  7. A data transmission method, comprising:
代理设备将收到的客户端设备发送的数据请求转发给服务器;  The proxy device forwards the received data request sent by the client device to the server;
所述代理设备接收所述服务器通过已建立的优化连接发送的响应数据,所 述优化连接是所述代理设备与所述服务器采用所述客户端设备支持的嵌入协 议建立的, 所述响应数据是基于所述嵌入协议的响应数据;  Receiving, by the proxy device, response data sent by the server through an established optimized connection, where the optimized connection is established by the proxy device and the server using an embedded protocol supported by the client device, and the response data is Response data based on the embedded protocol;
所述代理设备采用超文本传输协议将所述响应数据进行外层封装后发送 给所述客户端设备。  And the proxy device sends the response data to the client device by using a hypertext transfer protocol.
8、根据权利要求 7所述的方法, 所述代理设备将收到的客户端设备发送的 数据请求转发给服务器之前还包括:  The method according to claim 7, before the proxy device forwards the received data request sent by the client device to the server, the method further includes:
所述代理设备接收所述服务器发送的隧道指定消息,所述隧道指定消息中 携带所述客户端设备支持的嵌入协议的标识和所述客户端设备请求收看的节 目的标识;  The proxy device receives a tunnel designation message sent by the server, where the tunnel designation message carries an identifier of an embedded protocol supported by the client device and an identifier of a program that the client device requests to view;
采用所述客户端设备支持的嵌入协议与所述服务器建立优化连接; 在所述优化连接建立成功后,根据所述优化连接和所述隧道指定消息更新 第二对应关系, 所述第二对应关系中至少包括: 所述客户端设备请求收看的节 目和所述优化连接的对应关系。  Establishing an optimized connection with the server by using an embedded protocol supported by the client device; after the optimized connection is successfully established, updating a second correspondence according to the optimized connection and the tunnel designation message, the second correspondence The method at least includes: a correspondence between the program requested by the client device and the optimized connection.
9、根据权利要求 8所述的方法, 所述采用所述客户端设备支持的嵌入协议 与所述服务器建立优化连接之前还包括: 查询所述第二对应关系中是否已经存在所述节目对应的优化连接; 若不存在,则执行所述采用所述客户端设备支持的嵌入协议与所述服务器 建立优化连接的步骤; The method according to claim 8, wherein the using the embedded protocol supported by the client device to establish an optimized connection with the server further comprises: Querying, in the second correspondence, whether an optimized connection corresponding to the program already exists; if not, performing the step of establishing an optimized connection with the server by using an embedded protocol supported by the client device;
若已经存在, 则确定采用所述已经存在的优化连接。  If it already exists, it is determined to adopt the already existing optimized connection.
10、 根据权利要求 8或 9所述的方法, 其特征在于, 所述代理设备将收到的 所述客户端设备发送的数据请求转发给所述服务器之前还包括:  The method according to claim 8 or 9, wherein, before the proxy device forwards the received data request sent by the client device to the server, the method further includes:
建立并保存第三对应关系, 所述第三对应关系中至少包括: 所述客户端设 备与所述优化连接的对应关系。  The third correspondence is established and saved, and the third correspondence includes at least: a correspondence between the client device and the optimized connection.
11、 根据权利要求 10所述的方法, 其特征在于, 所述代理设备采用超文本 传输协议将所述响应数据进行外层封装后发送给所述客户端设备包括:  The method according to claim 10, wherein the proxy device sends the response data to the client device by using a hypertext transfer protocol, and the method includes:
从所述第三对应关系中查询所述优化连接对应的客户端设备;  Querying, from the third correspondence, the client device corresponding to the optimized connection;
将采用超文本传输协议进行了外层封装的所述响应数据发送给所述查询 到的客户端设备。  The response data that is outer-encapsulated using the hypertext transfer protocol is sent to the queried client device.
12、 一种服务器, 其特征在于, 包括:  12. A server, comprising:
获取模块, 用于获取客户端设备支持的嵌入协议;  An obtaining module, configured to obtain an embedded protocol supported by the client device;
连接建立模块, 用于指定一个代理设备, 采用所述客户端设备支持的嵌入 协议, 建立连接到所述代理设备的优化连接;  a connection establishing module, configured to specify a proxy device, and establish an optimized connection connected to the proxy device by using an embedded protocol supported by the client device;
接收模块, 用于接收所述代理设备转发的, 来自于所述客户端设备的数据 请求;  a receiving module, configured to receive, by the proxy device, a data request from the client device;
响应模块, 用于生成基于所述嵌入协议的响应数据,将所述响应数据通过 所述优化连接发送给所述代理设备,以便所述代理设备采用超文本传输协议将 所述响应数据进行外层封装后发送给所述客户端设备。  a response module, configured to generate response data based on the embedded protocol, and send the response data to the proxy device by using the optimized connection, so that the proxy device performs the outer layer of the response data by using a hypertext transfer protocol After being encapsulated, it is sent to the client device.
13、 根据权利要求 12所述的服务器, 其特征在于:  13. The server of claim 12, wherein:
所述获取模块, 具体用于接收所述客户端设备发送的隧道协商请求, 所述 隧道协商请求中包括客户端设备支持的嵌入协议的标识与客户端设备请求收 看的节目的标识, 所述嵌入协议包括 WebSocket协议和 /或多播协议。  The acquiring module is specifically configured to receive a tunnel negotiation request sent by the client device, where the tunnel negotiation request includes an identifier of an embedded protocol supported by the client device and an identifier of a program requested by the client device, where the The protocol includes the WebSocket protocol and/or multicast protocol.
14、 根据权利要求 13所述的服务器, 其特征在于, 还包括:  The server according to claim 13, further comprising:
关系建立模块,用于在所述连接建立模块成功建立起连接到所述代理设备 的优化连接之后, 建立并保存第一对应关系, 所述第一对应关系中至少包括: 客户端设备请求收看的节目和所述优化连接的对应关系。 a relationship establishing module, configured to establish and save a first correspondence after the connection establishment module successfully establishes an optimized connection that is connected to the proxy device, where the first correspondence includes at least: The correspondence between the program requested by the client device and the optimized connection.
15、 根据权利要求 14所述的服务器, 其特征在于:  15. The server of claim 14 wherein:
所述响应模块,具体用于根据所述数据请求中包括的节目的标识生成所述 节目的响应数据,根据所述第一对应关系获取所述节目对应的优化连接,将所 述节目的响应数据通过所述节目对应的优化连接发送给所述代理设备。  The response module is configured to generate response data of the program according to the identifier of the program included in the data request, obtain an optimized connection corresponding to the program according to the first correspondence, and send response data of the program. And transmitting to the proxy device by an optimized connection corresponding to the program.
16、 根据权利要求 14所述的服务器, 其特征在于, 还包括:  The server according to claim 14, further comprising:
查询模块,用于查询所述第一对应关系中是否已经存在所述节目的优化连 接;若不存在,则指示所述连接建立模块建立连接到所述代理设备的优化连接; 若已经存在, 则确定采用所述已经建立的优化连接。  a query module, configured to query whether an optimized connection of the program already exists in the first correspondence; if not, instructing the connection establishment module to establish an optimized connection connected to the proxy device; if yes, It is determined to adopt the established optimized connection.
17、 根据权利要求 12至 16中任一项所述的服务器, 其特征在于:  The server according to any one of claims 12 to 16, characterized in that:
所述连接建立模块, 具体用于发送隧道指定消息给所述代理设备, 所述隧 道指定消息中携带所述客户端设备支持的嵌入协议,以便采用所述嵌入协议建 立连接到所述代理设备的优化连接,在所述优化连接建立成功后,服务器将所 述代理设备的标识发送给所述客户端设备,以指示所述客户端设备将用于请求 节目数据的数据请求发送给所述代理设备。  The connection establishing module is specifically configured to send a tunnel designation message to the proxy device, where the tunnel designation message carries an embedded protocol supported by the client device, so as to establish a connection to the proxy device by using the embedded protocol. Optimizing the connection, after the optimized connection is successfully established, the server sends the identifier of the proxy device to the client device to instruct the client device to send a data request for requesting program data to the proxy device .
18、 一种代理设备, 其特征在于, 包括:  18. A proxy device, comprising:
请求转发模块, 用于将收到的客户端设备发送的数据请求转发给服务器; 数据接收模块,用于接收所述服务器通过已建立的优化连接发送的响应数 据,所述优化连接是所述代理设备与所述服务器采用所述客户端设备支持的嵌 入协议建立的, 所述响应数据是基于所述嵌入协议的响应数据;  a request forwarding module, configured to forward the data request sent by the received client device to the server; the data receiving module is configured to receive response data sent by the server through the established optimized connection, where the optimized connection is the proxy The device and the server are established by using an embedded protocol supported by the client device, and the response data is response data based on the embedded protocol;
数据发送模块,用于采用超文本传输协议将所述响应数据进行外层封装后 发送给所述客户端设备。  And a data sending module, configured to send the response data to the client device by using a hypertext transfer protocol.
19、 根据权利要求 18所述的代理设备, 其特征在于, 还包括:  The proxy device according to claim 18, further comprising:
连接建立模块, 用于接收所述服务器发送的隧道指定消息, 所述隧道指定 消息中携带所述客户端设备支持的嵌入协议的标识和所述客户端设备请求收 看的节目的标识,采用所述客户端设备支持的嵌入协议与所述服务器建立优化 连接;  a connection establishing module, configured to receive a tunnel designation message sent by the server, where the tunnel designation message carries an identifier of an embedded protocol supported by the client device and an identifier of a program requested by the client device, An embedded protocol supported by the client device establishes an optimized connection with the server;
关系建立模块, 用于在所述优化连接建立成功后,根据所述优化连接和所 述隧道指定消息更新第二对应关系, 所述第二对应关系中至少包括: 所述客户 端设备请求收看的节目和所述优化连接的对应关系。 a relationship establishing module, configured to: after the optimized connection is successfully established, update a second correspondence according to the optimized connection and the tunnel designation message, where the second correspondence includes at least: the client The correspondence between the program requested by the end device and the optimized connection.
20、 根据权利要求 19所述的代理设备, 其特征在于, 还包括:  The proxy device according to claim 19, further comprising:
查询模块,用于查询所述第二对应关系中是否已经存在所述节目对应的优 化连接; 若不存在, 则指示所述连接建立模块采用所述客户端设备支持的嵌入 协议与所述服务器建立优化连接; 若已经存在, 则确定采用所述已经存在的优 化连接。  a querying module, configured to query whether the optimized connection corresponding to the program already exists in the second corresponding relationship; if not, instructing the connection establishing module to establish with the server by using an embedded protocol supported by the client device Optimize the connection; if it already exists, then determine to use the existing optimized connection.
21、 根据权利要求 19或 20所述的代理设备, 其特征在于:  21. The proxy device according to claim 19 or 20, characterized in that:
所述关系建立模块,还用于在所述请求转发模块将收到的客户端设备发送 的数据请求转发给服务器之前, 建立并保存第三对应关系, 所述第三对应关系 中至少包括: 所述客户端设备与所述优化连接的对应关系。  The relationship establishing module is further configured to: before the request forwarding module forwards the received data request sent by the client device to the server, the third correspondence is established and saved, where the third correspondence includes at least: Corresponding relationship between the client device and the optimized connection.
22、 根据权利要求 21所述的代理设备, 其特征在于:  22. The proxy device according to claim 21, wherein:
所述数据发送模块,具体用于从所述第三对应关系中查询所述优化连接对 应的客户端设备;将采用超文本传输协议进行了外层封装的所述响应数据发送 给所述查询到的客户端设备。  The data sending module is configured to query, from the third correspondence, the client device corresponding to the optimized connection, and send the response data that is encapsulated by using a hypertext transfer protocol to the query. Client device.
PCT/CN2011/076176 2011-06-23 2011-06-23 Method and device for data transmission WO2012159287A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2011/076176 WO2012159287A1 (en) 2011-06-23 2011-06-23 Method and device for data transmission
CN201180000950.9A CN102439946B (en) 2011-06-23 2011-06-23 Data transmission method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2011/076176 WO2012159287A1 (en) 2011-06-23 2011-06-23 Method and device for data transmission

Publications (1)

Publication Number Publication Date
WO2012159287A1 true WO2012159287A1 (en) 2012-11-29

Family

ID=45986277

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/076176 WO2012159287A1 (en) 2011-06-23 2011-06-23 Method and device for data transmission

Country Status (2)

Country Link
CN (1) CN102439946B (en)
WO (1) WO2012159287A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103841086B (en) * 2012-11-23 2018-03-27 中兴通讯股份有限公司 A kind of data transmission method, device and terminal
CN103001800B (en) * 2012-11-28 2016-03-30 华为技术有限公司 Software entity automatic discovering method, service node and equipment
CN109525627B (en) * 2017-09-20 2022-02-25 腾讯科技(上海)有限公司 Data transmission method, data transmission device, storage medium and electronic device
CN110247926B (en) * 2019-06-28 2022-04-22 北京奇艺世纪科技有限公司 Interaction method and system
CN113946141B (en) * 2020-07-16 2022-09-06 卡奥斯工业智能研究院(青岛)有限公司 Network system for production demonstration line and control method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1408089A (en) * 1999-09-24 2003-04-02 阿坎巴公司 System and method for managing connections between client and server
US20050076126A1 (en) * 2003-10-06 2005-04-07 International Business Machines Corporation Tunneling non-HTTP traffic through a reverse proxy
CN101155053A (en) * 2006-09-25 2008-04-02 华为技术有限公司 Method and system for implementing multicast broadcasting service

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1408089A (en) * 1999-09-24 2003-04-02 阿坎巴公司 System and method for managing connections between client and server
US20050076126A1 (en) * 2003-10-06 2005-04-07 International Business Machines Corporation Tunneling non-HTTP traffic through a reverse proxy
CN101155053A (en) * 2006-09-25 2008-04-02 华为技术有限公司 Method and system for implementing multicast broadcasting service

Also Published As

Publication number Publication date
CN102439946B (en) 2014-05-21
CN102439946A (en) 2012-05-02

Similar Documents

Publication Publication Date Title
JP2015172954A (en) System and method for combining pull mode and push mode
US11051078B2 (en) Video distribution method and device
WO2010124550A1 (en) Content delivery method and device and content delivery network system
WO2008101444A1 (en) A streaming media system, signaling transmitting device and sending method of streaming media
US9544351B1 (en) Media sharing and consumption
KR102132266B1 (en) Secondary node type based control for data streaming
WO2009039745A1 (en) A data processing method, apparatus and system
WO2012159287A1 (en) Method and device for data transmission
WO2009021460A1 (en) Method for reporting implement result of policy, network communication system and equipment
WO2015027429A1 (en) Aggregation transmission method, device and system, network server and user equipment
WO2014117408A1 (en) Method and device for transmitting streaming media data
KR102070149B1 (en) Method for delivery of content by means of caching in communication network and apparatus thereof
JP2020536459A (en) Network support for uplink streaming
WO2012083841A1 (en) Method, terminal and system for changing channel
WO2011144173A1 (en) Method, apparatus and system for processing media contents
JP7237117B2 (en) Terminal device, data processing device and method
WO2019100912A1 (en) Data distribution method and distribution server
WO2014206263A1 (en) Packet transmission method, system, and station
WO2009015539A1 (en) Multicast control method for service of demanding the media content and the system thereof
KR101469310B1 (en) Method and system for end-to-end QoS guaranteed content delivery on service overlay network
WO2012163016A1 (en) Method, media server and terminal device for identifying service request type
US8095651B2 (en) Delayable events in home network
WO2011020380A1 (en) Streaming media server system and related implementation method, device, and iptv system
US20140161125A1 (en) Method, duplication point device, and system for data flow reuse transmission
WO2010025635A1 (en) Method of switching of play, media server, user terminal and system thereof

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201180000950.9

Country of ref document: CN

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

Ref document number: 11866318

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11866318

Country of ref document: EP

Kind code of ref document: A1