Sse-based streaming data processing display method and system, and related device

By establishing an SSE connection on the client side and using a data buffer and message queue to process the SSE data stream, the problem of discontinuous SSE data stream presentation in existing technologies is solved, resulting in a smooth user interface display and improved response performance.

CN122268848APending Publication Date: 2026-06-23SHENZHEN MAIFENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN MAIFENG TECH CO LTD
Filing Date
2026-02-28
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing technologies, when processing SSE data streams, cause text content to exhibit abrupt changes, resulting in a clunky and disjointed user experience.

Method used

By establishing an SSE connection with the server, data fragments are continuously received and scanned using data buffers and message queues. Message delimiters are identified to extract individual messages, which are then split into character sequences and periodically rendered to the user interface. Timers and reconnection strategies are combined to ensure smooth display.

Benefits of technology

It achieves a smooth typewriter display effect and improves the response performance of SSE streaming data in complex business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122268848A_ABST
    Figure CN122268848A_ABST
Patent Text Reader

Abstract

The application provides a kind of based on SSE's stream data processing display method, system and related equipment, method includes based on the preset parameter construction and initiates HTTP request, establishes the SSE connection with server;In the data stream of the SSE connection, continuously receive data segment and append to data buffer;The data buffer is scanned and identified pre-defined message separator, to extract one or more independent SSE message from the data buffer and store in message queue;From the message queue, the SSE message is obtained, and the SSE message is split into character sequence and stored in character queue;According to the preset timer, periodically take out single or multiple characters from the character queue, render the character to user interface.The application realizes the smooth typewriter display effect by constructing double-layer queue rendering technology, and improves the response performance of SSE stream data in complex business scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer communication technology, and in particular to a streaming data processing and display method, system and related equipment based on SSE. Background Technology

[0002] With the development of modern network applications, especially the widespread adoption of scenarios such as large-scale language models, artificial intelligence, real-time data monitoring, and online collaboration, the demand for real-time, one-way data stream communication between clients and servers is increasing. In this context, Server-Sent Events (SSE) technology, due to its advantages such as being based on the standard HTTP protocol, simple to implement, lightweight, and efficient, has become an ideal choice for enabling servers to push data to clients.

[0003] In existing technologies for receiving and processing SSE data streams on the client side, the parsed data is usually processed using a "block update" method. This means that whenever a complete message is parsed, it is immediately appended to the UI as a whole. This method results in a jumpy increase in text content, leading to a clunky and disjointed user experience.

[0004] Therefore, existing technologies still need to be improved and developed. Summary of the Invention

[0005] This invention provides a streaming data processing and display method, system, and related equipment based on SSE. The main objective of this invention is to solve the technical problems mentioned in the background section of the prior art.

[0006] The first aspect of this invention provides a streaming data processing and display method based on SSE, comprising: An HTTP request is constructed and initiated based on preset parameters to establish an SSE connection with the server. The preset parameters include the request method, request headers, and request body. In the data stream of the SSE connection, data segments are continuously received and appended to the data buffer; The data buffer is scanned to identify predefined message delimiters in order to extract one or more independent SSE messages from the data buffer and store them in a message queue. The SSE message is retrieved from the message queue, and the SSE message is split into a character sequence and stored in the character queue. According to a preset timer, one or more characters are periodically retrieved from the character queue and rendered onto the user interface.

[0007] In an optional embodiment of the first aspect of the present invention, after establishing an SSE connection with the server by constructing and initiating an HTTP request based on preset parameters, the method further includes: Monitor the status of the SSE connection; When the SSE connection is detected to be interrupted due to a network error, the HTTP request is automatically re-initiated according to a preset reconnection policy to attempt to restore the SSE connection.

[0008] In an optional embodiment of the first aspect of the invention, the reconnection strategy includes a maximum number of retries and employs an exponential backoff time interval.

[0009] In an optional embodiment of the first aspect of the present invention, the step of scanning the data buffer to identify predefined message delimiters, in order to extract one or more independent SSE messages from the data buffer and store them in a message queue, includes: Maintain a scan position pointer that records the scanned positions; After each newly received data segment is appended to the data buffer, the message delimiter is searched backward from the position indicated by the scan position pointer. After successfully extracting data corresponding to an SSE message, the data corresponding to the SSE message is removed from the data buffer, and the scan position pointer is updated accordingly.

[0010] In an optional embodiment of the first aspect of the present invention, the step of scanning the data buffer to identify predefined message delimiters, so as to extract one or more independent SSE messages from the data buffer and store them in a message queue, further includes: The data corresponding to the SSE message is parsed into a structured SSE event object. The data corresponding to the SSE message includes a message identifier, event type, message data, and / or reconnection time field. The structured SSE message is stored in the message queue.

[0011] In an optional embodiment of the first aspect of the present invention, the step of periodically retrieving one or more characters from the character queue according to a preset timer and rendering the characters to the user interface includes: The period of the timer is dynamically adjusted based on the number of messages to be processed in the message queue. When the quantity exceeds a preset threshold, the period of the timer is shortened to speed up the rendering process.

[0012] In an optional embodiment of the first aspect of the present invention, rendering the characters to the user interface includes: The predefined format or control markers in the character sequence are parsed, and rich text styles are identified and applied or corresponding control instructions are executed, including screen clearing or line breaks.

[0013] A second aspect of the present invention provides a streaming data processing and display system based on SSE, the streaming data processing and display system based on SSE comprising: The connection establishment module is used to construct and initiate an HTTP request based on preset parameters to establish an SSE connection with the server. The preset parameters include the request method, request header, and request body. The data buffer module is used to continuously receive data segments in the data stream of the SSE connection and append them to the data buffer; The message extraction and caching module is used to scan the data buffer to identify predefined message delimiters, so as to extract one or more independent SSE messages from the data buffer and store them in the message queue. A character sequence caching module is used to retrieve the SSE message from the message queue and split the SSE message into a character sequence and store it in the character queue; The character extraction and rendering module is used to periodically extract one or more characters from the character queue according to a preset timer and render the characters to the user interface.

[0014] A third aspect of the present invention provides a streaming data processing display device based on SSE, the streaming data processing display device based on SSE comprising: a memory and at least one processor, the memory storing instructions, and the memory and the at least one processor being interconnected via a line; The at least one processor invokes the instructions in the memory to cause the SSE-based streaming data processing display device to perform the SSE-based streaming data processing display method as described in any one of the first aspects of the present invention.

[0015] A fourth aspect of the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the SSE-based streaming data processing and display method as described in any one of the first aspects of the present invention.

[0016] Beneficial Effects: This invention provides a streaming data processing and display method, system, and related equipment based on SSE (Streaming Sequence Rendering). The method includes: constructing and initiating an HTTP request based on preset parameters to establish an SSE connection with a server; continuously receiving data segments in the data stream of the SSE connection and appending them to a data buffer; scanning the data buffer to identify predefined message delimiters to extract one or more independent SSE messages from the data buffer and storing them in a message queue; retrieving the SSE messages from the message queue and splitting them into character sequences to store in a character queue; periodically retrieving one or more characters from the character queue according to a preset timer and rendering the characters to the user interface. This invention achieves a smooth typewriter display effect by constructing a two-layer queue rendering technology, improving the response performance of SSE streaming data in complex business scenarios. Attached Figure Description

[0017] Figure 1 This is a schematic diagram of an embodiment of a streaming data processing and display method based on SSE according to the present invention; Figure 2 This is a schematic diagram of an embodiment of a streaming data processing and display system based on SSE according to the present invention; Figure 3 This is a schematic diagram of an embodiment of a streaming data processing and display device based on SSE according to the present invention. Detailed Implementation

[0018] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0019] The first aspect of this invention provides a streaming data processing and display method based on SSE, which can be deployed in applications on client devices, such as smartphones, tablets, or personal computers, for efficient and stable communication and interactive content display with servers that support SSE streaming responses.

[0020] See Figure 1 The SSE-based streaming data processing and display method includes: S100. Based on preset parameters, construct and initiate an HTTP request to establish an SSE connection with the server. The preset parameters include a request method, request headers, and a request body. In this step of the present invention, the client system defines a set of preset parameters according to business requirements and encapsulates them into a configuration object.

[0021] For example: URL: https: / / api.example.com / v1 / chat_stream; Request method: POST; Request header: {"Authorization": "Bearer sk-xxxx", "Content-Type": "application / json", "Accept": "text / event-stream"}; Request body: A JSON object containing user query information, such as {"query": "Please introduce SSE technology", "user_id": "user123", "response_mode": "streaming"}.

[0022] When the client request build and connection service receives the above configuration object, it will use a native network framework (such as URLSession) to build a URLRequest instance, set the request method to POST, fill in the request header, and serialize the request body JSON object into a Data type and assign it to request.httpBody. Then, it will initiate a dataTask task through the native network framework to establish a persistent HTTP connection (i.e., SSE connection) with the server. This task is configured to allow continuous reception of data streams, rather than returning all data at once.

[0023] Most existing SSE client implementations or open-source libraries primarily support establishing connections via the HTTP GET method by default. However, in many real-world business scenarios, such as interacting with APIs of large language models, clients need to send a large amount of context information, user configurations, or session credentials to the server. Passing this complex data via URL parameters is neither secure nor convenient. Therefore, server-side interfaces typically require the use of the HTTP POST method, transmitting these parameters through the request body and custom request headers. Existing technologies generally lack native support for POST requests and custom request headers and bodies, making them unsuitable for direct application in such scenarios.

[0024] Furthermore, in an optional embodiment of the first aspect of the present invention, in order to ensure the reliability of the connection, an automatic reconnection mechanism can be set in the client system, that is, after establishing an SSE connection with the server by constructing and initiating an HTTP request based on preset parameters, the method further includes: Monitor the status of the SSE connection; in this step, for example, a state manager can be responsible for monitoring the health of the SSE connection. The state manager can be implemented by listening to the network framework's error callback methods (such as urlSession(_:task:didCompleteWithError:)). When this method is called with a network error (such as timeout or DNS resolution failure), the state manager can determine that the connection has been interrupted.

[0025] When an SSE connection is detected to be interrupted due to a network error, the HTTP request is automatically re-initiated to attempt to restore the SSE connection according to a preset reconnection strategy. This reconnection strategy includes a maximum number of retries and an exponential backoff interval. Specifically, in this invention, once the client system detects an interruption, the state manager triggers the request construction and connection service to execute reconnection logic. This logic follows a preset reconnection strategy, which can be configured as follows: maximum number of retries: 5 times; reconnection interval: using an exponential backoff algorithm, for example, waiting 1 second for the first reconnection, 2 seconds for the second, 4 seconds for the third, and so on, until a maximum interval (e.g., 30 seconds) is reached. This avoids short-term, high-frequency connection surges to the server during server or network failures.

[0026] S200. In the data stream of the SSE connection, data segments are continuously received and appended to the data buffer. In this invention, after the SSE connection is established, the server continuously pushes data. The client can receive binary data (Data) segments of variable length through the proxy method of the network framework (such as urlSession(_:dataTask:didReceive:)). The client maintains a data buffer (e.g., NSMutableData). Whenever a new data segment is received, it is appended to the end of the data buffer.

[0027] S300: The data buffer is scanned to identify predefined message delimiters, so as to extract one or more independent SSE messages from the data buffer and store them in a message queue. In this invention, the client system continuously scans the data buffer to find predefined message delimiters in the SSE protocol, which are usually two consecutive newline characters. When a delimiter is found, the data from the beginning of the buffer to the delimiter is regarded as one or more complete original SSE message blocks. The extracted SSE message blocks are then placed into a first-in-first-out (FIFO) message queue, which stores the complete text segments to be displayed.

[0028] Furthermore, in this invention, to improve parsing efficiency, the client does not start from the beginning every time it scans the data buffer. The client maintains a scan position pointer (e.g., an integer variable scanIndex) to record the position where the last scan ended. When a new data segment is appended to the buffer, the scan operation starts from the position indicated by scanIndex, instead of starting from the beginning position 0 of the buffer. When a complete message block is successfully extracted and processed, the data corresponding to the message block is removed from the buffer, and scanIndex is updated accordingly (e.g., if N bytes are removed, scanIndex is subtracted by N) to ensure that the relative position of the pointer is correct. This method significantly reduces the repeated scanning of processed data.

[0029] In an optional embodiment of the first aspect of the present invention, the step of scanning the data buffer to identify predefined message delimiters in order to extract one or more independent SSE messages from the data buffer and store them in a message queue includes: maintaining a scan position pointer that records the scanned positions; after each newly received data segment is appended to the data buffer, searching for message delimiters backward from the position indicated by the scan position pointer; after successfully extracting data corresponding to an SSE message, removing the data corresponding to the SSE message from the data buffer and updating the scan position pointer accordingly.

[0030] Furthermore, in this invention, to enable subsequent rendering business logic to perform different operations based on event type or use id for message tracing, making the system logic clearer and more scalable, after extracting the original message block from the data buffer, the string of the original message block is not directly stored in the message queue. Instead, it is first structured and parsed. Taking a common SSE message block as an example, its structure can be as follows: id: msg-1; event: text-chunk; data: {"content": "This is a text fragment"}; retry: 5000. During parsing, the system extracts the values ​​of the id, event, data, and retry fields and uses these values ​​to instantiate a predefined SSEEvent data structure. Then, the structured SSEEvent object is stored in the message queue. The instantiated SSEEvent data structure can be as follows: { "id": "msg-1", "event": "text-chunk", "data": { "content": "This is a text fragment", "timestamp": "2023-10-25T10:00:00Z" }, "retry": 5000 }

[0031] In an optional embodiment of the first aspect of the present invention, the step of scanning the data buffer to identify predefined message delimiters to extract one or more independent SSE messages from the data buffer and store them in the message queue further includes: parsing the data corresponding to the SSE message into a structured SSE event object, wherein the data corresponding to the SSE message includes a message identifier, event type, message data and / or reconnection time field; and storing the structured SSE message in the message queue.

[0032] S400. Obtain the SSE message from the message queue and split the SSE message into a character sequence and store it in the character queue. In this invention, the client also maintains an independent character queue, which monitors the message queue. When the character queue is empty and the message queue is not empty, the character queue takes a text segment from the head of the message queue, splits it into a character array (i.e., a character sequence), and stores it in the character queue.

[0033] S500. According to a preset timer, one or more characters are periodically retrieved from the character queue and rendered onto the user interface. In this invention, the client has a preset timer (initially triggered every 50ms). Each time the timer is triggered, it retrieves a character from the head of the character queue and appends it to the end of the text view (such as UITextView) of the user interface. Through this two-layer queue mechanism, the suddenness of data reception and the smoothness of interface rendering are effectively decoupled. Even if the server pushes a large amount of text instantly, it is only queued in the message queue first, while the interface is always rendered character by character at a fixed rhythm, thus ensuring a smooth user experience.

[0034] Furthermore, in an optional embodiment of the first aspect of the present invention, in order to better balance the smoothness and efficiency of rendering, a dynamic rendering rate adjustment mechanism can be set. That is, before each time a character is to be retrieved from the character queue for rendering, the current length of the message queue (i.e., the number of messages to be processed) is checked. The system presets one or more thresholds. For example, the timer period corresponding to the normal rendering speed is 50ms. When the message queue length is detected to be >10, the system determines that there is a message backlog. In order to allow the user to see the content as soon as possible, the timer period will be dynamically shortened to 25ms, doubling the typing speed. When the message queue length falls below the threshold, it will return to the normal 50ms. That is, before the present invention periodically retrieves one or more characters from the character queue according to the preset timer and renders the characters to the user interface, it includes: dynamically adjusting the timer period according to the number of messages to be processed in the message queue; when the number exceeds the preset threshold, shortening the timer period to speed up the rendering speed.

[0035] Furthermore, in an optional embodiment of the first aspect of the present invention, in order to achieve richer dynamic interactive effects, rendering the characters to the user interface includes: parsing predefined formats or control tags in the character sequence, identifying and applying rich text styles or executing corresponding control commands, the control commands including clearing the screen or line breaks. Specifically, in this step, if the JSON parsed from the data field of the SSEEvent object is {"text": "Important Notice", "style": "bold"}, then during rendering, the system will create an NSAttributedString (rich text string) with a bold attribute and append it to the interface; if the parsed JSON is {"command": "clear_screen"}, the system will recognize it as a control command, will not render any text, but will instead clear the current text view content.

[0036] See Figure 2 The second aspect of the present invention provides a streaming data processing and display system based on SSE, the streaming data processing and display system based on SSE comprising: The connection establishment module 10 is used to construct and initiate an HTTP request based on preset parameters to establish an SSE connection with the server. The preset parameters include the request method, request header, and request body. Data buffer module 20 is used to continuously receive data segments and append them to the data buffer in the data stream of the SSE connection; The message extraction and caching module 30 is used to scan the data buffer to identify predefined message delimiters, so as to extract one or more independent SSE messages from the data buffer and store them in the message queue. The character sequence caching module 40 is used to retrieve the SSE message from the message queue and split the SSE message into a character sequence and store it in the character queue; The character extraction and rendering module 50 is used to periodically extract one or more characters from the character queue according to a preset timer and render the characters to the user interface.

[0037] In an optional embodiment of the second aspect of the present invention, the SSE-based streaming data processing and display system further includes: The disconnection and reconnection module is used to monitor the status of the SSE connection; when the SSE connection is detected to be interrupted due to a network error, the module automatically re-initiates the HTTP request to attempt to restore the SSE connection according to a preset reconnection strategy.

[0038] In an optional embodiment of the second aspect of the invention, the reconnection strategy includes a maximum number of retries and employs an exponential backoff time interval.

[0039] In an optional embodiment of the second aspect of the present invention, the message extraction and caching module includes: The pointer setting unit is used to maintain a scan position pointer that records the scanned positions; The data search unit is used to search for message delimiters from the position indicated by the scan position pointer each time a newly received data segment is appended to the data buffer. The pointer update unit is used to remove the data corresponding to the SSE message from the data buffer after successfully extracting the data corresponding to the SSE message, and update the scan position pointer accordingly.

[0040] In an optional embodiment of the second aspect of the present invention, the message extraction and caching module further includes: The structured processing unit is used to parse the data corresponding to the SSE message into a structured SSE event object. The data corresponding to the SSE message includes a message identifier, event type, message data, and / or reconnection time field. A message caching unit is used to store the structured SSE message into the message queue.

[0041] In an optional embodiment of the second aspect of the present invention, the SSE-based streaming data processing and display system further includes: The period adjustment module is used to dynamically adjust the period of the timer based on the number of messages to be processed in the message queue; when the number exceeds a preset threshold, the period of the timer is shortened to speed up the rendering process.

[0042] In an optional embodiment of the second aspect of the present invention, the SSE-based streaming data processing and display system further includes: The dynamic interaction module is used to parse the predefined format or control mark in the character sequence, identify and apply rich text styles or execute corresponding control instructions, including clearing the screen or creating a newline.

[0043] Figure 3 This is a schematic diagram of a streaming data processing display device based on SSE provided in an embodiment of the present invention. This SSE-based streaming data processing display device can vary significantly due to different configurations or performance characteristics. It may include one or more processors 60 (central processing units, CPUs) (e.g., one or more processors) and memory 70, and one or more storage media 80 (e.g., one or more mass storage devices) for storing applications or data. The memory and storage media can be temporary or persistent storage. The program stored in the storage media may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the SSE-based streaming data processing display device. Furthermore, the processor may be configured to communicate with the storage media and execute the series of instruction operations in the storage media on the SSE-based streaming data processing display device.

[0044] The SSE-based streaming data processing display device of this invention may further include one or more power supplies 90, one or more wired or wireless network interfaces 100, one or more input / output interfaces 110, and / or one or more operating systems, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will understand that... Figure 3 The illustrated structure of the SSE-based streaming data processing display device does not constitute a limitation on the SSE-based streaming data processing display device. It may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.

[0045] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the steps of the SSE-based streaming data processing and display method.

[0046] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system or system / unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0047] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0048] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A streaming data processing and display method based on SSE, characterized in that, include: An HTTP request is constructed and initiated based on preset parameters to establish an SSE connection with the server. The preset parameters include the request method, request headers, and request body. In the data stream of the SSE connection, data segments are continuously received and appended to the data buffer; The data buffer is scanned to identify predefined message delimiters in order to extract one or more independent SSE messages from the data buffer and store them in a message queue. The SSE message is retrieved from the message queue, and the SSE message is split into a character sequence and stored in the character queue. According to a preset timer, one or more characters are periodically retrieved from the character queue and rendered onto the user interface.

2. The streaming data processing and display method based on SSE according to claim 1, characterized in that, After establishing an SSE connection with the server by constructing and initiating an HTTP request based on preset parameters, the process also includes: Monitor the status of the SSE connection; When the SSE connection is detected to be interrupted due to a network error, the HTTP request is automatically re-initiated according to a preset reconnection policy to attempt to restore the SSE connection.

3. The streaming data processing and display method based on SSE according to claim 2, characterized in that, The reconnection strategy includes a maximum number of retries and uses an exponential backoff time interval.

4. The streaming data processing and display method based on SSE according to claim 1, characterized in that, The step of scanning the data buffer to identify predefined message delimiters, in order to extract one or more independent SSE messages from the data buffer and store them in a message queue, includes: Maintain a scan position pointer that records the scanned positions; After each newly received data segment is appended to the data buffer, the message delimiter is searched backward from the position indicated by the scan position pointer. After successfully extracting data corresponding to an SSE message, the data corresponding to the SSE message is removed from the data buffer, and the scan position pointer is updated accordingly.

5. The streaming data processing and display method based on SSE according to claim 1, characterized in that, The step of scanning the data buffer to identify predefined message delimiters, in order to extract one or more independent SSE messages from the data buffer and store them in the message queue, further includes: The data corresponding to the SSE message is parsed into a structured SSE event object. The data corresponding to the SSE message includes a message identifier, event type, message data, and / or reconnection time field. The structured SSE message is stored in the message queue.

6. The streaming data processing and display method based on SSE according to claim 1, characterized in that, The step of periodically retrieving one or more characters from the character queue according to a preset timer and rendering the characters to the user interface includes: The period of the timer is dynamically adjusted based on the number of messages to be processed in the message queue. When the quantity exceeds a preset threshold, the period of the timer is shortened to speed up the rendering process.

7. The streaming data processing and display method based on SSE according to claim 1, characterized in that, The step of rendering the characters to the user interface includes: The predefined format or control markers in the character sequence are parsed, and rich text styles are identified and applied or corresponding control instructions are executed, including screen clearing or line breaks.

8. A streaming data processing and display system based on SSE, characterized in that, The SSE-based streaming data processing and display system includes: The connection establishment module is used to construct and initiate an HTTP request based on preset parameters to establish an SSE connection with the server. The preset parameters include the request method, request header, and request body. The data buffer module is used to continuously receive data segments in the data stream of the SSE connection and append them to the data buffer; The message extraction and caching module is used to scan the data buffer to identify predefined message delimiters, so as to extract one or more independent SSE messages from the data buffer and store them in the message queue. A character sequence caching module is used to retrieve the SSE message from the message queue and split the SSE message into a character sequence and store it in the character queue; The character extraction and rendering module is used to periodically extract one or more characters from the character queue according to a preset timer and render the characters to the user interface.

9. A streaming data processing and display device based on SSE, characterized in that, The SSE-based streaming data processing display device includes: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor invokes the instructions in the memory to cause the SSE-based streaming data processing display device to perform the SSE-based streaming data processing display method as described in any one of claims 1-7.

10. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by the processor, it implements the SSE-based streaming data processing and display method as described in any one of claims 1-7.