CN-122027687-A - Push method and related device for stream message block
Abstract
The application discloses a pushing method of a streaming message block and a related device, and relates to the technical field of computer information; if the idle response result returned by the service server equipment is received, the service server equipment executes asynchronous logic based on the service request parameter to obtain the streaming message block, and the obtained streaming message block and the corresponding request data identifier are associated and stored in the message cache queue, and meanwhile the message cache queue is polled until the streaming message block containing the end identifier corresponding to the request data identifier is obtained, and all the streaming message blocks are pushed to the client equipment. The application does not need a push request initiated by the client equipment at high frequency, and improves the effective utilization rate of network resources.
Inventors
- DONG GANG
- WEI WANG
- LIU JIANLONG
- WU DIE
- Min Shengwu
Assignees
- 携程旅游网络技术(上海)有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260224
Claims (10)
- 1. A method for pushing a streaming message block, wherein the method is applied to a gateway server device, and the method comprises: Receiving a push request sent by client equipment, wherein the push request comprises a request data identifier and a service request parameter; judging whether at least one streaming message block corresponding to the request data identifier exists in the acquired message cache queue; If any stream message block corresponding to the request data identifier does not exist in the message cache queue, the request data identifier and the service request parameter are sent to service server equipment; And if a null response result returned by the service server equipment is received, acquiring a streaming message block obtained by asynchronous logic of the service server equipment based on the service request parameter, and a request data identifier corresponding to the streaming message block, storing the acquired streaming message block and the request data identifier corresponding to the acquired streaming message block in the message cache queue in an associated manner, and simultaneously polling the message cache queue until a target streaming message block corresponding to the request data identifier is obtained, and pushing all the streaming message blocks corresponding to the request data identifier in the message cache queue to the client equipment, wherein the target streaming data block is the streaming data block containing the end identifier.
- 2. The push method of streaming message blocks according to claim 1, wherein the push request further comprises a message cursor; After the judging whether at least one streaming message block corresponding to the request data identifier exists in the acquired message cache queue, the method further comprises: If at least one streaming message block corresponding to the request data identifier exists in the message cache queue, determining a streaming message block sequence corresponding to the request data identifier based on the message cursor and a plurality of streaming message blocks corresponding to the request data identifier; Judging whether the target streaming message block exists in the streaming message block sequence; Pushing the sequence of streaming message blocks to the client device if the target streaming message block exists in the sequence of streaming message blocks; And if the target streaming message block does not exist in the streaming message block sequence, returning to the step of executing the judgment of whether the target streaming message block exists in the streaming message block sequence by a first preset time period.
- 3. The method for pushing a streaming message block according to claim 2, wherein determining, based on the message cursor and the plurality of streaming message blocks corresponding to the request data identifier, a sequence of streaming message blocks corresponding to the request data identifier comprises: If the message cursor is zero, determining a stream message block sequence formed by a plurality of stream message blocks corresponding to the request data identifier as the stream message block sequence corresponding to the request data identifier; and if the message cursor is larger than zero, selecting the corresponding stream message block with the position identifier not smaller than the message cursor from the stream message blocks corresponding to the request data identifier, and determining the stream message block sequence formed by the stream message blocks obtained by screening as the stream message block sequence corresponding to the request data identifier.
- 4. The push method of streaming message blocks according to claim 1, wherein the push request further comprises a scene identifier; Before the request data identifier and the service request parameter are sent to the service server device, the method further comprises: inquiring the service server equipment corresponding to the scene identifier, and acquiring a service address of the service server equipment; the sending the request data identifier and the service request parameter to a service server device includes: And transmitting the request data identifier and the service request parameter to the service server equipment based on the service address of the service server equipment.
- 5. The method for pushing a streaming message block according to claim 1, wherein polling the message buffer queue until the target streaming message block corresponding to the request data identifier is obtained comprises: after one streaming message block corresponding to the request data identifier is stored in the message cache queue, judging whether the streaming message block corresponding to the request data identifier stored in the message cache queue is the target streaming message block or not; And if the streaming message block corresponding to the request data identifier stored in the message cache queue is not the target streaming message block, returning to execute the step of judging whether the streaming message block corresponding to the request data identifier stored in the message cache queue is the target streaming message block or not in a second preset time period until the streaming message block corresponding to the request data identifier stored in the message cache queue is the target streaming message block.
- 6. The method for pushing a streaming message block according to claim 1, wherein after said sending the request data identifier and the service request parameter to a service server device, the method further comprises: If a service response result returned by the service server-side equipment is received, converting the service response result into a streaming message block and a request data identifier corresponding to the streaming message block; Pushing the converted streaming message block to the client device, and storing the converted streaming message block and the request data identifier corresponding to the converted streaming message block in the message cache queue in an associated manner.
- 7. The method of pushing a streaming message block according to claim 1, further comprising: And polling the message cache queue, and sending a polling overtime signal to the client device if the streaming message block corresponding to the request data identifier is not obtained in a third preset time period.
- 8. A computer program product comprising computer readable instructions which, when run on an electronic device, cause the electronic device to implement the method of pushing streaming message blocks according to any of claims 1 to 7.
- 9. An electronic device comprising at least one processor and a memory coupled to the processor, wherein: the memory is used for storing a computer program; The processor is configured to execute the computer program to enable the electronic device to implement the method of pushing streaming message blocks according to any of claims 1 to 7.
- 10. A computer storage medium carrying one or more computer programs which, when executed by an electronic device, enable the electronic device to implement a method of pushing streaming message blocks according to any of claims 1 to 7.
Description
Push method and related device for stream message block Technical Field The present application relates to the field of computer information technologies, and in particular, to a method and an apparatus for pushing a streaming message block. Background With the rapid development of internet application to real-time and interactive directions, the pushing requirements of scenes such as live broadcasting, online education, real-time data analysis and the like on streaming message blocks are increasingly urgent, so that a pushing mechanism of the streaming message blocks is a core technical foundation for supporting modern interactive services. Thus, the pushing of streaming message blocks is particularly important. Currently, pushing of a streaming message block depends on a master polling mechanism of a client device, that is, the client device sends a pushing request to a server device at fixed time intervals, when the server device does not have a corresponding streaming message block capable of returning, an empty response result is continuously returned to the client device until the corresponding streaming message block capable of returning returns a service response result to the client device. However, when the server-side equipment does not respond to the result, the server-side equipment continuously returns an empty response result to the client-side equipment, so that a large number of invalid push requests and response results appear, a large amount of network bandwidth resources are occupied, and the effective utilization rate of the network resources is greatly reduced. Disclosure of Invention In view of the above problems, the present application provides a method for pushing a streaming message block and a related device, and in order to improve the effective utilization rate of network resources, the specific scheme is as follows: the first aspect of the present application provides a method for pushing a streaming message block, where the method is applied to a gateway server device, and the method includes: Receiving a push request sent by client equipment, wherein the push request comprises a request data identifier and a service request parameter; judging whether at least one streaming message block corresponding to the request data identifier exists in the acquired message cache queue; If any stream message block corresponding to the request data identifier does not exist in the message cache queue, the request data identifier and the service request parameter are sent to service server equipment; And if a null response result returned by the service server equipment is received, acquiring a streaming message block obtained by asynchronous logic of the service server equipment based on the service request parameter, and a request data identifier corresponding to the streaming message block, storing the acquired streaming message block and the request data identifier corresponding to the acquired streaming message block in the message cache queue in an associated manner, and simultaneously polling the message cache queue until a target streaming message block corresponding to the request data identifier is obtained, and pushing all the streaming message blocks corresponding to the request data identifier in the message cache queue to the client equipment, wherein the target streaming data block is the streaming data block containing the end identifier. In one possible implementation, the push request further includes a message cursor; After the judging whether at least one streaming message block corresponding to the request data identifier exists in the acquired message cache queue, the method further comprises: If at least one streaming message block corresponding to the request data identifier exists in the message cache queue, determining a streaming message block sequence corresponding to the request data identifier based on the message cursor and a plurality of streaming message blocks corresponding to the request data identifier; Judging whether the target streaming message block exists in the streaming message block sequence; Pushing the sequence of streaming message blocks to the client device if the target streaming message block exists in the sequence of streaming message blocks; And if the target streaming message block does not exist in the streaming message block sequence, returning to the step of executing the judgment of whether the target streaming message block exists in the streaming message block sequence by a first preset time period. In one possible implementation, the determining, based on the message cursor and the plurality of streaming message blocks corresponding to the request data identifier, a sequence of streaming message blocks corresponding to the request data identifier includes: If the message cursor is zero, determining a stream message block sequence formed by a plurality of stream message blocks corresponding to the request data identifier as the str