Sse streaming output interrupt control method and device, server and medium
By using the data transmission control field in SSE streaming output, the client can actively control the interruption of streaming output, solving the server performance problem caused by forced network shutdown in the existing technology and realizing elegant streaming output control.
Patent Information
- Application Number
- CN202411234943.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2044-09-04
AI Technical Summary
When the client needs to interrupt the server streaming output, the existing SSE technology usually needs to forcibly close the network connection, affecting the server performance.
By obtaining the unique identifier of the client, querying and updating the data transmission control field, and judging whether to interrupt the streaming output according to the field value, the client can actively control the interruption of the streaming output.
Without closing the network connection, the client can gracefully interrupt the server streaming output, avoiding network anomalies and protecting server performance.
Smart Images

Figure CN119182817B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of data transmission, and particularly relate to an interrupt control method and device for SSE stream output, a server and a medium. BACKGROUND
[0002] SSE (Server-Sent Events) is a technology that allows a server to send streaming data to a client, and the client can continuously transmit streaming data without further requests during data transmission. The conventional SSE technology has the following characteristics: one-way communication, persistent connection, HTTP-based, automatic reconnection and simple implementation. This data transmission method is suitable for scenarios such as push notification, real-time update and data stream.
[0003] Since the conventional SSE technology is a one-way communication technology, if the client wants to interrupt the content transmitted by the server at a certain time point, the client usually has no way to inform the server. Therefore, in the prior art, in order to interrupt the continuous transmission of streaming data, the network connection between the client and the server has to be forcibly closed. When the server discovers that the network is disconnected, an exception will be thrown, and the server needs to handle the exception, thereby affecting the performance of the server. SUMMARY
[0004] Embodiments of the present application provide an interrupt control method and device for SSE stream output, a server and a medium, aiming to actively interrupt the server's stream output on the premise of keeping the network connection between the client and the server.
[0005] In a first aspect, an interrupt control method for SSE stream output is provided, comprising:
[0006] obtaining a data transmission interrupt request sent by a client, the data transmission interrupt request comprising a unique identifier of the client;
[0007] querying a stored corresponding data transmission control field according to the unique identifier of the client and updating the data transmission control field, the data transmission control field being used to identify whether to interrupt the stream output of current data;
[0008] judging whether to interrupt the stream output of current data according to the query result of the data transmission control field.
[0009] In a second aspect, an interrupt control device for SSE stream output is also provided, comprising:
[0010] an obtaining unit, configured to obtain a data transmission interrupt request sent by a client, the data transmission interrupt request comprising a unique identifier of the client;
[0011] an updating unit, configured to query a stored corresponding data transmission control field according to the unique identifier of the client and update the data transmission control field, wherein the data transmission control field is used to identify whether to interrupt the streaming output of the current data;
[0012] A judging unit is configured to judge whether to interrupt the streaming output of the current data according to a query result of the data transmission control field.
[0013] In a third aspect, an embodiment of the present invention further provides a server, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.
[0014] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program can implement the above method when executed by a processor.
[0015] The embodiment of the present invention provides a method, device, server and medium for interruption control of SSE streaming output. The method includes: obtaining a data transmission interruption request sent by a client, the data transmission interruption request including a unique identifier of the client; querying a stored corresponding data transmission control field according to the unique identifier of the client and updating the data transmission control field, the data transmission control field being used to identify whether to interrupt the streaming output of the current data; and judging whether to interrupt the streaming output of the current data according to the query result of the data transmission control field. According to the technical solution of the embodiment of the present invention, when the server performs data streaming with the client, it will query the stored data transmission control field, and judge whether to interrupt the streaming with the client according to the value of the field. The client can modify the value of the data transmission control field through the data transmission interruption request, thereby actively interrupting the streaming output of the server, and will not generate abnormalities such as network disconnection during the entire process of actively interrupting the streaming output, thereby not affecting the performance of the server. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 A flow chart of an SSE streaming output interrupt control method provided by an embodiment of the present invention;
[0018] Figure 2A schematic diagram of SSE streaming for a client and a server;
[0019] Figure 3 A flowchart of another interruption control method of SSE streaming provided by an embodiment of the present application;
[0020] Figure 4 A schematic block diagram of an interruption control device of SSE streaming provided by an embodiment of the present application;
[0021] Figure 5 A schematic block diagram of a server provided by an embodiment of the present application. DETAILED DESCRIPTION
[0022] The technical solutions in the embodiments of the present application will be clearly and completely described with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0023] It should be understood that, when used in the specification and the appended claims, the terms "comprise" and "include" indicate the presence of described features, integers, steps, operations, elements, and / or components, but do not exclude one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0024] It should also be understood that the terms used in the present application specification are only for the purpose of describing particular embodiments and are not intended to limit the present application. As used in the present application specification and the appended claims, unless otherwise clearly indicated by the context, the singular forms "a", "an" and "the" are intended to include the plural forms.
[0025] It should be further understood that the term "and / or" used in the present application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0026] As used in the present application specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if [a described condition or event] is detected" can be interpreted to mean "upon determining", or "in response to determining", or "upon detecting [the described condition or event]", or "in response to detecting [the described condition or event]", depending on the context.
[0027] Please refer toFigure 1 , Figure 1 is a flowchart of an interrupt control method of SSE streaming output provided by an embodiment of the present application. The interrupt control method of SSE streaming output is described in detail below. As shown in Figure 1 , the method comprises the following steps S110-S140.
[0028] S110, obtaining a data transmission interrupt request sent by a client, the data transmission interrupt request comprising a unique identifier of the client.
[0029] In an embodiment of the present application, for the convenience of understanding, the SSE technology is first described. SSE is a technology that allows a server to actively send data to a client. Unlike the traditional HTTP request-response mode, SSE provides a lightweight, one-way communication mechanism, enabling the server to push information to the client in real time. This technology is very suitable for scenarios that require real-time updates, such as stock quotes, real-time news push, online chat applications, etc. Specifically, as shown in Figure 2 , the SSE technology has the following characteristics: one-way communication: SSE is one-way, only data can be sent from the server to the client. Persistent connection: once the client connects to the server, the connection will remain open until the client or server explicitly closes it. Based on HTTP: SSE uses a standard HTTP connection, but uses a special Content-Type (text / event-stream) to identify the data stream. Automatic reconnection: if the connection is disconnected, most browsers will automatically try to reconnect. Simple implementation: the client uses the EventSource interface of JavaScript to receive data, while the implementation of the server depends on specific server technology.
[0030] Since the SSE technology adopts a one-way communication mode, if the streaming output of the server needs to be interrupted, the server needs to open an interface, and the client accesses this interface by creating a new thread. The client carries the unique identifier of the client itself, such as "id": 1001, when sending the data transmission interrupt request. The server obtains the request and starts to execute the subsequent steps.
[0031] S120, querying a stored corresponding data transmission control field according to the unique identifier of the client and updating the data transmission control field, the data transmission control field being used to identify whether to interrupt the streaming output of the current data.
[0032] In an embodiment of the present invention, after a server receives a data transmission interruption request from a client, it queries a database based on the unique identifier of the client carried in the data transmission interruption request, and queries the corresponding data transmission control field. Specifically, the data transmission control field is used to indicate whether to interrupt the current streaming output. When the data transmission control field "isInterrupted" is "true", the current streaming output is interrupted; when the data transmission control field "isInterrupted" is "false", the current streaming output continues. The data transmission control field defaults to "false" when it is created. Therefore, in response to the data transmission interruption request, when the server queries "isInterrupted" to be "false", it needs to update "false" to "true", thereby allowing the current streaming output to be interrupted when the server makes subsequent queries. It should be noted that the database used to store data transmission control fields can replace various types of caches (such as Redis, Memcached, memory cache, etc.), message queues (such as RabbitMQ, Kafka, RocketMQ, etc.), MQTT (Message Queuing Telemetry Transport)-based middleware, and shared network file storage (such as Alibaba Cloud OSS and other cloud services) and other persistent networked components.
[0033] In one embodiment, the method further includes: obtaining an SSE data transmission request sent by a client, the SSE data transmission request including a unique identifier of the client, and streaming data to the client after a connection is established; and querying a currently stored corresponding data transmission control field based on the unique identifier of the client during data streaming with the client. This step is used to establish streaming data transmission between the client and the server. After the client and the server have established data streaming, the server periodically queries the currently stored corresponding data transmission control field based on the unique identifier of the client. Specifically, the step of querying the currently stored corresponding data transmission control field based on the unique identifier of the client during data streaming with the client further includes: querying the currently stored corresponding data transmission control field based on the unique identifier of the client after each round of streaming data transmission with the client. In this embodiment, to ensure normal data transmission each time, a field query is performed after each data transmission from the server to the client. That is, when the server sends streaming data to the client, after each stream of data is sent, the server queries a data transmission control field "isInterrupted" in the database.
[0034] S130: Determine whether to interrupt the streaming output of the current data according to the query result of the data transmission control field.
[0035] In the embodiment of the present application, the initial value of the data transmission control field is false, and the step of judging whether to interrupt the current data streaming output according to the query result of the data transmission control field further comprises: if the data transmission control field is true, interrupting the current data streaming output; and if the data transmission control field is false, continuing the current data streaming output.
[0036] Specifically, the server queries the corresponding data transmission control field "isInterrupted" in the database according to the unique identifier of the client, and the value of the data transmission control field is "true" or "false". When the server queries that the current corresponding data transmission control field "isInterrupted" is "true", the server interrupts the current streaming output and simultaneously interrupts the SSE connection with the client. When the server queries that the current corresponding data transmission control field "isInterrupted" is "false", the current streaming output is continued, and the next query is waited for. As can be seen, in the present scheme, the streaming output is interrupted first, and then the connection between the server and the client is disconnected. The server does not generate an error, and the graceful end of the output can ensure that the server performance is not affected, which is suitable for scenarios to improve service experience.
[0037] In one embodiment, after the step of judging whether to interrupt the current data streaming output according to the query result of the data transmission control field, the method further comprises: when the streaming output with the client is interrupted, disconnecting the connection with the client and restoring the data transmission control field corresponding to the unique identifier of the client to false, to wait for the next re-establishment of data transmission. Specifically, when the server responds to the interruption request of the client, the connection with the client is disconnected. Since the data transmission control field "isInterrupted" corresponding to the client has been updated to "true" before, if the client needs to re-establish the SSE transmission with the server subsequently, the corresponding transmission control field "isInterrupted" needs to be restored to "false" after the network interruption between the server and the client. In this way, it is ensured that the subsequent re-establishment of the SSE streaming data transmission between the client and the server can be performed normally.
[0038] In the embodiment of the present application, the server queries the stored data transmission control field when performing data streaming transmission with the client, judges whether to interrupt the streaming transmission with the client according to the value of the field, and the client can modify the value of the data transmission control field through a data transmission interruption request, thereby actively interrupting the streaming output of the server, and no network disconnection or other abnormalities occur in the whole process of actively interrupting the streaming output, thereby not affecting the performance of the server.
[0039] In one embodiment, referring to Figure 3 The flowchart of the interruption control method of the SSE streaming output is shown, and the specific implementation steps are as follows:
[0040] First, the user requests the SSE interface on the client side, and the client creates a thread to call the SSE interface of the server. Among them, the client carries the unique identification of the client when calling the SSE interface, such as the parameter {“id”:1001}.
[0041] Then, when the server receives the interface request sent by the client to establish a connection, it starts to execute the business logic, that is, the server starts to output the first stream data. During the data transmission process, the server will query the data transmission control field of id 1001 in the database according to the streaming output situation, and judge whether the data transmission control field “isInterrupted” field is “true”. If the query “isInterrupted” field is “true”, the data transmission is interrupted and the connection with the client is disconnected, if the query “isInterrupted” field is “false”, the data streaming transmission is continued.
[0042] When the user needs to actively interrupt the server streaming transmission, another thread is created through the client to request a HTTP interface of the server, while carrying the unique identification of the client, such as the parameter {“id”:1001}.
[0043] Then, after the server receives the parameter {“id”:1001}, it updates the corresponding data transmission control field “isInterrupted” in the database, and updates the value of the data transmission control field “isInterrupted” to “true”. It should be noted that when the server and the client establish a connection to start streaming transmission, the server can create the data transmission control field “isInterrupted” corresponding to the client in the database, and the default value of this field when created is “false”. Subsequently, when the server queries the “isInterrupted” value corresponding to the client id in the database during data transmission, it is directly ended if the “isInterrupted” value is updated to “true”, that is, the client can gracefully interrupt the server's streaming output, without producing network disconnection exceptions, effectively reducing the server load, and can be applied to streaming interruption of various projects using SSE technology (such as large language models, etc.).
[0044] In one embodiment, the data transmission interruption request further comprises an interruption timing parameter, and the method further comprises: when it is queried that the data transmission of the client needs to be interrupted, timing control is performed on the time of interrupting the data transmission according to the interruption timing parameter.
[0045] In the embodiment of the application, when the user interrupts the streaming output of the server through the client, the interruption can be controlled through different service variables. Specifically, the data transmission interruption request further comprises an interruption timing parameter. For example, the parameter countDown:5 is carried, which indicates that the server is told to disconnect after 5 seconds of countdown, and the server can be allowed to perform some service processing before disconnection. When the server queries that the data transmission of the client needs to be interrupted, the interruption timing parameter countDown:5 is obtained, and the data transmission is disconnected after 5 seconds of countdown.
[0046] In the embodiment, the timing of interruption is controlled through the interruption timing parameter, and the server can be ensured to have sufficient time to perform other services before interrupting the streaming output.
[0047] In one embodiment, the data transmission interruption request further comprises an interruption trigger condition parameter, and the method further comprises: querying the state bit corresponding to the current server according to the terminal trigger condition parameter, and disconnecting the streaming output of the client when the state bit meets the trigger condition.
[0048] In the embodiment of the application, when the user interrupts the streaming output of the server through the client, the interruption can be further controlled through the setting of the trigger condition parameter. For example, when the client sends the data transmission interruption request server interface through a thread, some state values dependent on the server are carried, such as isStatus:true, which indicates that the server is told to disconnect when a certain state bit (isStatus) of the server service side is true. Alternatively, the server needs to monitor the current usage rate, and the streaming output is interrupted when the usage rate exceeds a certain threshold. When the server obtains the request, the current state bit is checked, and the streaming output of the client is interrupted when the current state bit meets the trigger condition.
[0049] In the embodiment, the timing of interrupting the streaming output of the server is further controlled through the monitoring of the state value of the server, and the streaming output of the server can be interrupted more flexibly.
[0050] Figure 4 is a schematic block diagram of an interruption control device 200 of an SSE streaming output provided by the embodiment of the application. As shown in the figure, the interruption control device 200 comprises a data transmission interruption request receiving unit 201, a state bit checking unit 202, and a data transmission interruption unit 203. Figure 4Corresponding to the above SSE streaming interruption control method, the present application also provides an SSE streaming interruption control device 200. The SSE streaming interruption control device 200 includes units for performing the above SSE streaming interruption control method, and the device can be configured in a server. Specifically, please refer to Figure 4 The SSE streaming interruption control device 200 includes an acquisition unit 201, an update unit 202, and a judgment unit 203.
[0051] The acquisition unit 201 is configured to acquire a data transmission interruption request sent by a client, and the data transmission interruption request includes a unique identifier of the client; the update unit 202 is configured to query a stored corresponding data transmission control field according to the unique identifier of the client and update the data transmission control field, and the data transmission control field is used to identify whether to interrupt the streaming output of current data; and the judgment unit 203 is configured to judge whether to interrupt the streaming output of current data according to a query result of the data transmission control field.
[0052] In some embodiments, for example in the present embodiment, the data transmission interruption request further includes an interruption trigger condition parameter, and the SSE streaming interruption control device 200 further includes a control unit configured to query a state bit corresponding to a current server according to the terminal trigger condition parameter, and disconnect the streaming output with the client when the state bit meets the trigger condition.
[0053] In some embodiments, for example in the present embodiment, the SSE streaming interruption control device 200 further includes a query unit configured to acquire an SSE data transmission request sent by a client, the SSE data transmission request includes a unique identifier of the client, and the streaming output of data to the client is performed after the connection is established; and the query unit is configured to query a currently stored corresponding data transmission control field according to the unique identifier of the client during the streaming output of data to the client.
[0054] In some embodiments, for example in the present embodiment, the query unit is further configured to query the currently stored corresponding data transmission control field according to the unique identifier of the client after each round of streaming data transmission with the client.
[0055] In some embodiments, for example in the present embodiment, the judgment unit 203 is further configured to interrupt the streaming output of current data if the data transmission control field is true, and continue the streaming output of current data if the data transmission control field is false.
[0056] In some embodiments, for example in the present embodiment, the SSE streaming interruption control device 200 further comprises a recovery unit, configured to: when the streaming with the client is interrupted, disconnect the connection with the client and restore the data transmission control field corresponding to the unique identification of the client to false, to wait for the next re-establishment of data transmission.
[0057] The above-mentioned SSE streaming interruption control device can be implemented in the form of a computer program, which can run on a server as shown in the figure. Figure 5
[0058] Please refer to Figure 5 , Figure 5 is a schematic block diagram of a server provided by an embodiment of the present application. Please refer to Figure 5 , the server 300 comprises a processor 302, a memory and a network interface 305 connected through a system bus 301, wherein the memory can comprise a non-volatile storage medium 303 and an internal memory 304.
[0059] The non-volatile storage medium 303 can store an operating system 3031 and a computer program 3032. The computer program 3032, when executed, can make the processor 302 execute an SSE streaming interruption control method.
[0060] The processor 302 is configured to provide computing and control capabilities to support the operation of the entire server 300.
[0061] The internal memory 304 provides an environment for the execution of the computer program 3032 in the non-volatile storage medium 303, and the computer program 3032, when executed by the processor 302, can make the processor 302 execute an SSE streaming interruption control method.
[0062] The network interface 305 is configured to perform network communication with other devices. Those skilled in the art can understand that Figure 5 the structure shown in the figure is only a block diagram of part of the structure related to the present application scheme, and does not constitute a limitation on the server 300 to which the present application scheme is applied. The specific server 300 can comprise more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0063] Among them, the processor 302 is configured to run the computer program 3032 stored in the memory to implement any embodiment of the above-mentioned SSE streaming interruption control method.
[0064] It should be appreciated that in the embodiments of the present application, the processor 302 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic components, discrete hardware components, etc. The general-purpose processor can be a microprocessor or can also be any conventional processor.
[0065] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to realize the process steps of the above-mentioned embodiments.
[0066] Therefore, the present application also provides a storage medium. The storage medium can be a computer-readable storage medium. The storage medium stores a computer program. The computer program is executed by a processor to make the processor execute any embodiment of the above-mentioned interrupt control method for SSE stream output.
[0067] The storage medium can be a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, and various computer-readable storage media that can store program codes.
[0068] It can be understood by those skilled in the art that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized in electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in the above description in general terms. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0069] In several embodiments provided by the present application, it should be understood that the disclosed apparatus and method can be implemented in other manners. For example, the described apparatus embodiments are merely schematic. For example, the division of the units is merely a logical function division. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. Thus, the division of the units in the embodiments should be considered as a logical function division, and there can be other division manners in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0070] The steps in the method embodiments of the present application can be adjusted, combined and deleted in sequence according to actual needs. The units in the apparatus embodiments of the present application can be combined, divided and deleted according to actual needs. In addition, each functional unit in each embodiment of the present application can be integrated in a processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.
[0071] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a storage medium. Based on such understanding, the technical solutions of the present application essentially or say the part that contributes to the prior art, or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a server to execute all or part of the steps of the methods described in the embodiments of the present application.
[0072] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0073] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, these modifications and variations of the present application are intended to be included within the scope of the present application, and the present application is intended to include these modifications and variations.
[0074] The above description is merely specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any modifications or replacements easily conceived by those skilled in the art within the technical scope disclosed by the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for controlling interruption of SSE stream output, characterized in that: include: Acquire a data transmission interruption request sent by a client, wherein the data transmission interruption request includes a unique identifier of the client; querying a corresponding stored data transmission control field according to the unique identifier of the client and updating the data transmission control field, wherein the data transmission control field is used to identify whether to interrupt the streaming output of the current data; Determine whether to interrupt the streaming output of the current data according to the query result of the data transmission control field.
2. The method according to claim 1, characterized in that The data transmission interruption request also includes an interruption timing parameter, and the method further includes: When it is found that the data transmission needs to be interrupted for the client, the time for interrupting the data transmission is controlled according to the interruption timing parameter.
3. The method according to claim 1, characterized in that The data transmission interruption request also includes an interruption triggering condition parameter, and the method further includes: The status bit corresponding to the current server is queried according to the terminal trigger condition parameter, and the streaming output with the client is disconnected when the status bit meets the trigger condition.
4. The method according to claim 1, wherein The method further comprises: Obtain an SSE data transmission request sent by the client, the SSE data transmission request including a unique identifier of the client, and stream data to the client after a connection is established; During data streaming output with the client, the currently stored corresponding data transmission control field is queried according to the unique identifier of the client.
5. The method according to claim 4, characterized in that The step of querying the currently stored corresponding data transmission control field according to the unique identifier of the client during the data streaming output process with the client further includes: After each round of streaming data transmission with the client, the currently stored corresponding data transmission control field is queried according to the unique identifier of the client.
6. The method according to claim 1, characterized in that The initial value of the data transmission control field is false, and the step of determining whether to interrupt the streaming output of the current data according to the query result of the data transmission control field further includes: If the data transmission control field is true, the streaming output of the current data is interrupted; if the data transmission control field is false, the streaming output of the current data is continued.
7. The method according to claim 6, characterized in that After the step of determining whether to interrupt the streaming output of the current data according to the query result of the data transmission control field, the method further includes: After the streaming output with the client is interrupted, the connection with the client is disconnected and the data transmission control field corresponding to the unique identifier of the client is restored to false, waiting for the next re-establishment of data transmission.
8. An interrupt control device for SSE streaming output, characterized in that: include: an acquiring unit, configured to acquire a data transmission interruption request sent by a client, wherein the data transmission interruption request includes a unique identifier of the client; an updating unit, configured to query a stored corresponding data transmission control field according to the unique identifier of the client and update the data transmission control field, wherein the data transmission control field is used to identify whether to interrupt the streaming output of the current data; A judging unit is configured to judge whether to interrupt the streaming output of the current data according to a query result of the data transmission control field.
9. A server, characterized in that: The server includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the computer program can implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
User-level interrupts in virtual machines
CN116069440A
Systems and methods for embedding interrupts into a serial data stream
US20110101872A1