Data display method and device and electronic equipment

By using MQTT Broker as an intermediate proxy component in BS architecture application services, data transmission between the server and the browser is realized, which solves the problems of excessive server burden and insufficient data real-time performance, and improves data transmission efficiency and system stability.

CN119415790APending Publication Date: 2025-02-11SUPCON TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411440222.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

When BS architecture application services realize automatic data refresh, due to the direct interaction between the browser and the server, the server is overburdened and the data is insufficient in real-time.

Method used

By establishing a long connection between the server and the message queue telemetry transmission agent component MQTT Broker, the data transmission between the server and the browser is realized, the browser's service request is received, and the result is processed and sent to the browser through the MQTT Broker.

Benefits of technology

It reduces the transmission burden of the server, improves data transmission efficiency, ensures the stability of the system, and solves the problem of insufficient real-time data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415790A_ABST
    Figure CN119415790A_ABST
Patent Text Reader

Abstract

The invention discloses a data display method and device and electronic equipment. The method comprises the steps that long connection between a server and a message queue telemetry transmission proxy component MQTT Broker is established, and the MQTT Broker is used for achieving data transmission between the server and a browser; receiving a service request sent by the browser through the MQTT Broker, and processing the service request to obtain a service processing result; and sending the business processing result to a browser through the MQTT Broker for display. According to the method and the device, the technical problems of overburden of the server and insufficient data real-time performance due to direct interaction between the browser and the server when the BS architecture application service in the related technology realizes automatic data refreshing are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data transmission, and in particular to a method, device and electronic device for data display. Background Art

[0002] Application services based on BS architecture usually face the following scenarios: users hope that data can be automatically refreshed on certain business pages. For example, in the Dashboard scenario, one interface involves multiple client-service interface interactions, including statistical charts, status displays, message push, etc.

[0003] In the related technology, there are two implementation schemes. First, the browser sends a request to the server through a scheduled request, and obtains the data of multiple interfaces for unified display. Second, the browser and the server establish a Websocket long connection communication. The browser and the server only need to complete a handshake once, and a persistent connection can be directly created between the two, and two-way data transmission can be carried out.

[0004] However, in the above two implementation methods, both are direct interactions between the browser and the server, which have technical problems such as heavy server burden, insufficient data real-time performance, waste of resources, and complex connection management.

[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0006] The embodiments of the present application provide a method, device and electronic device for data display, so as to at least solve the technical problems that the BS architecture application service in the related technology usually directly interacts with the browser and the server when realizing automatic data refresh, resulting in excessive server burden and insufficient data real-time performance.

[0007] According to one aspect of an embodiment of the present application, a method for data display is provided, including: establishing a long connection between a server and a message queue telemetry transmission agent component MQTT Broker, wherein the MQTT Broker is used to implement data transmission between the server and the browser; receiving a business request sent by the browser through the MQTT Broker, and processing the business request to obtain a business processing result; and sending the business processing result to the browser through the MQTT Broker for display.

[0008] Optionally, receiving a service request sent by a browser through an MQTT Broker includes: receiving a first service request sent by the browser through an MQTT Broker within a first time period, wherein the first service request is used to represent the same service request initiated by multiple browsers.

[0009] Optionally, the method also includes: determining the subscription status of the first topic of the target browser, wherein the target browser is any one of the browsers, the first topic is used to represent a specific topic corresponding to the first business request, and the number of first topics is greater than or equal to 1; when the target browser subscribes to the first topic, sending topic change data corresponding to the first topic to the target browser via the MQTT Broker.

[0010] Optionally, the method also includes: determining a first display result corresponding to the first business request; determining an update operation performed by the target browser on the first display result, and updating the first display result according to the update operation to obtain a second display result; and sending the second display result to other browsers through an MQTT Broker, wherein the other browsers are browsers other than the target browser.

[0011] Optionally, receiving a service request sent by a browser through an MQTT Broker further includes: receiving a second service request sent by a target browser through an MQTT Broker within a second time period, wherein the second service request is used to represent multiple different service requests initiated by the target browser.

[0012] Optionally, the method also includes: determining the business name, source ID and request ID of the target business request, wherein the target business request is any one of the second business requests; processing the target business request according to the business name to obtain a target processing result; and sending the target processing result to the target browser for display via the MQTT Broker according to the source ID and request ID.

[0013] Optionally, the method also includes: determining the configuration of the second topic of the server, wherein the second topic is used to receive an offline prompt message sent by the browser; when the server is configured with the second topic, after the browser exits, receiving a prompt message sent by the browser through the MQTT Broker, wherein the prompt message is used to prompt that the browser is in an offline state.

[0014] According to another aspect of an embodiment of the present application, a method for data display is also provided, including: establishing a long connection between a browser and a message queue telemetry transmission agent component MQTT Broker, wherein the MQTT Broker is used to realize data transmission between a server and a browser; sending a business request to a server through the MQTT Broker; receiving a business processing result sent by the server through the MQTT Broker, and displaying the business processing result, wherein the business processing result is used to represent the result after processing the business request.

[0015] According to another aspect of the embodiment of the present application, a data display device is also provided, including: a first establishment module, used to establish a long connection between the server and the message queue telemetry transmission agent component MQTT Broker, wherein the MQTT Broker is used to realize data transmission between the server and the browser; a receiving module, used to receive the business request sent by the browser through the MQTT Broker, and process the business request to obtain the business processing result; a first sending module, used to send the business processing result to the browser through the MQTT Broker for display.

[0016] According to another aspect of the embodiment of the present application, a data display device is also provided, including: a second establishment module, used to establish a long connection between a browser and a message queue telemetry transmission agent component MQTT Broker, wherein MQTT Broker is used to realize data transmission between a server and a browser; a second sending module, used to send a business request to a server through MQTT Broker; a display module, used to receive a business processing result sent by the server through MQTT Broker, and display the business processing result, wherein the business processing result is used to represent the result after processing the business request.

[0017] According to another aspect of the embodiments of the present application, there is also provided an electronic device, including: a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the method for realizing the above-mentioned data display.

[0018] According to another aspect of the embodiments of the present application, a non-volatile storage medium is provided, the non-volatile storage medium includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned data display method by running the computer program.

[0019] According to another aspect of the embodiments of the present application, a computer program product is provided, including computer instructions, which implement the above-mentioned data display method when executed by a processor.

[0020] In an embodiment of the present application, a long connection is established between a server and a message queue telemetry transmission agent component MQTT Broker, wherein the MQTT Broker is used to realize data transmission between the server and the browser; a business request sent by the browser through the MQTT Broker is received, and the business request is processed to obtain a business processing result; the business processing result is sent to the browser through the MQTT Broker for display, thereby achieving the purpose of data transmission between the server and the browser based on the intermediate agent component MQTT Broker, thereby achieving the technical effect of reducing the transmission burden of the server, improving data transmission efficiency and maintaining system stability, and further solving the technical problems of excessive server burden and insufficient data real-time performance due to the fact that the BS architecture application service in the related technology usually interacts directly with the browser and the server when realizing automatic data refresh. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0022] Figure 1 is a hardware structure diagram of a computer terminal for implementing a method for data display according to an embodiment of the present application;

[0023] Figure 2 is a flow chart of a method for data display according to an embodiment of the present application;

[0024] Figure 3 It is a schematic diagram of an interaction model among a server, an MQTT Broker and a browser according to an embodiment of the present application;

[0025] Figure 4 is a schematic diagram of a data transmission process according to an embodiment of the present application;

[0026] Figure 5 is a schematic diagram of another data transmission process according to an embodiment of the present application;

[0027] Figure 6 is a flow chart of another method for data display according to an embodiment of the present application;

[0028] Figure 7 is a structural diagram of a data display device according to an embodiment of the present application;

[0029] Figure 8 It is a structural diagram of another data display device according to an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0032] First, some nouns or terms that appear in the process of explaining the embodiments of the present application are subject to the following explanations:

[0033] BS architecture (Browser-Server Architecture): A network application architecture model in which the user interface is mainly implemented through the browser, while the application logic and data storage are concentrated on the server side. This architecture allows users to access applications through a web browser without installing additional software on the client side.

[0034] Dashboard: A data dashboard or data dashboard is a visual data display tool that is usually used to display and analyze key performance indicators and other important data. It can present complex data in the form of charts, tables and graphs to help users quickly obtain key information and make decisions.

[0035] Websocket: A network communication protocol that provides the ability to perform full-duplex communication over a single TCP connection, which means that data can be transmitted bidirectionally between the client and the server in real time. It is suitable for web applications that require real-time communication.

[0036] MQTT (Message Queuing Telemetry Transport): A lightweight communication protocol designed specifically for communication between IoT devices. It is based on a publish / subscribe model, allowing real-time communication between devices while having the characteristics of low bandwidth and low power consumption.

[0037] MQTT Broker (Message Queuing Telemetry Transport Broker): A middleware used to transmit messages for communication between IoT devices. It acts as a message broker, responsible for receiving and forwarding messages to ensure smooth communication between devices.

[0038] TCP (Transmission Control Protocol) is a connection-oriented, reliable, byte-stream-based transport layer communication protocol. It is one of the core components of the Internet protocol suite and is usually used together with the IP protocol (Internet Protocol), collectively known as TCP / IP.

[0039] In order to solve the problem of poor data transmission capacity between the server and the browser in the related art, the embodiment of the present application provides a method for data display applied to the server and a method for data display applied to the browser. The method for data display applied to the server and the method for data display applied to the browser can both be run on Figure 1 In the computer terminal shown, the computer terminal is described below using a method for displaying data applied to a server.

[0040] The data display method embodiment provided in the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal for implementing a method for data display. Figure 1 As shown, the computer terminal 10 may include one or more (102a, 102b, ..., 102n are used to illustrate) processors (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions connected via a wired and / or wireless network. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art can understand that Figure 1The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0041] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10. As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0042] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the method of data display in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the above-mentioned method of data display. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0043] The transmission module 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission module 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission module 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0044] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 .

[0045] It should be noted that, in some optional embodiments, the above Figure 1The computer terminal shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. It should be noted that Figure 1 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the computer terminal described above.

[0046] In the above-mentioned operating environment, an embodiment of the present application provides a method embodiment of data display. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0047] Figure 2 is a flow chart of a method for data display according to an embodiment of the present application, such as Figure 2 As shown, the method is applied to the server and includes the following steps:

[0048] Step S202, establishing a long connection between the server and the message queue telemetry transmission agent component MQTT Broker, wherein the MQTT Broker is used to realize data transmission between the server and the browser.

[0049] In the above step S202, after the server application is started, it will initialize the communication with the MQTT Broker, that is, establish a long connection between the server and the MQTT Broker. The specific process can be as follows:

[0050] 1. Initialize the MQTT client: The server uses the MQTT protocol stack to create a client instance, which is used to represent the interface for communicating with the Broker using the MQTT protocol, and configures related parameters such as the Broker address, port, and Client ID.

[0051] 2. Establish a TCP connection: The server can use the MQTT client's connection method (such as connect()) to initiate a TCP connection request to the specified port of the MQTTBroker.

[0052] 3. Connection confirmation: Once the TCP connection is established, the connection process of the MQTT protocol begins. The server sends a message to establish the connection (such as a CONNECT message), and the Broker responds with a control message to confirm the connection (such as a CONNACK message) to confirm the establishment of the connection.

[0053] 4. Maintain the connection: The server periodically sends PINGREQ messages, and the Broker responds with PINGRESP to keep the connection active.

[0054] In the embodiment of the present application, after the server establishes a stable long connection with the MQTT Broker, it needs to listen to the following three specific topics to flexibly handle various requests and events from the browser. The details are as follows:

[0055] Topic 1: Business calls initiated by browser pages.

[0056] {fromServer} / {arrivedServer} / connect / {clientId} / {sessionId} / {businessName};

[0057] This topic 1 is used to process business requests from the browser. When the browser requires the back-end server to execute specific business logic, it will send a message to this topic, allowing the back-end server to receive and respond to business calls and perform corresponding operations, such as data processing, calculation results, etc.

[0058] Topic 2: Browser page logout.

[0059] {fromServer} / disconnect / {clientId};

[0060] This topic 2 is used to handle logout requests when users exit the browser page or close the application. When the user is no longer interacting with the page, the backend server can perform cleanup operations such as releasing resources, ending the session, and disconnecting.

[0061] Topic 3: Browser page business logout.

[0062] {fromServer} / disconnect / {clientId} / {sessionId};

[0063] This topic 3 is used to process the logout or cancellation of a specific business request. For example, if a user cancels an ongoing business operation in a browser, the backend server is allowed to stop the ongoing business processing and clean up the resources and status related to the specific business.

[0064] The parameters involved in the above three topics are described as follows:

[0065] fromServer: The source service name. A unified name needs to be specified globally. For example, the front end can be identified as web.

[0066] arrivedServer: The name of the message receiving service. A unified name needs to be specified globally. For example, the log module can be identified as logger.

[0067] clientId: Source ID, a globally unique ID assigned by the source service, used to identify different service sources.

[0068] sessionId: request ID, a globally unique ID assigned by the source service, used to uniquely identify each request.

[0069] businessName: business name (method name), which is specified by the source service and specifies the behavior that the recipient needs to perform.

[0070] In the embodiment of the present application, when the browser opens the page, it will also establish a stable long connection with the MQTT Broker, where there are two connection parameters as follows:

[0071] Client ID: can be set as an identifier. Client ID needs to be globally unique. When the element in the browser page sends a request to the backend server, it needs to be carried in the corresponding business request or subject. The server will distinguish the source of the business request based on the Client ID.

[0072] Will Topic: Will topic, used to specify that when the browser disconnects abnormally, if the server is configured with WillTopic, the MQTT Broker will automatically send messages to this topic. Other servers subscribed to this topic will also receive a notification when the browser disconnects abnormally.

[0073] Figure 3 Schematic diagram of an interaction model among a server, MQTT Broker and a browser according to an embodiment of the present application. Figure 3 As shown in the figure, MQTT Broker is used to realize data transmission between server and browser, where Browser1, Browser2, ..., BrowserN on the left represent multiple different browser instances, which can be opened by different users on their respective devices; the MQTT Broker in the middle represents the core proxy component in the MQTT protocol, which is responsible for relaying and distributing messages; the Server on the right represents the backend server, which provides business logic processing and maintains real-time communication with the MQTT Broker.

[0074] Step S204, receiving the service request sent by the browser through the MQTT Broker, and processing the service request to obtain a service processing result.

[0075] In the above step S204, the server can receive the same business request sent by multiple browsers through the MQTT Broker, or it can receive multiple different business requests sent by one browser through the MQTT Broker. Subsequently, the server calls the corresponding business logic processing program according to the received business request, performs necessary operations such as database query and calculation, and obtains the business processing result.

[0076] Step S206: Send the business processing result to the browser through the MQTT Broker for display.

[0077] In the above step S206, the server can encapsulate the business processing result into an MQTT message, select the appropriate QoS level, and set the correct topic, and then send it to the corresponding browser through the MQTT Broker. After receiving the business processing result forwarded by the MQTT Broker, the browser can also update the business processing result displayed on the browser interface according to business needs to display the latest business processing result.

[0078] Through the above steps S202 to S206, the purpose of data transmission between the server and the browser based on the intermediate proxy component MQTT Broker is achieved, thereby achieving the technical effect of reducing the transmission burden of the server, improving data transmission efficiency and maintaining system stability, thereby solving the technical problem that the BS architecture application service in the related technology usually directly interacts with the browser and the server when realizing automatic data refresh, resulting in excessive server burden and insufficient data real-time performance. The following is a detailed description.

[0079] Optionally, receiving a service request sent by a browser through an MQTT Broker includes: receiving a first service request sent by the browser through an MQTT Broker within a first time period, wherein the first service request is used to represent the same service request initiated by multiple browsers.

[0080] Figure 4 FIG. 1 is a schematic diagram of a data transmission process according to an embodiment of the present application. Figure 4 As shown in the figure, this data transmission process is suitable for high-concurrency business processing, such as the scenario where multiple browsers obtain server data through MQTT Broker. The details are as follows:

[0081] In any time period (such as the first time period mentioned above), multiple browsers (such as Figure 4 SessionA and SessionB in the example respectively establish a persistent connection with the MQTT Broker and send the same service request (i.e. the first service request mentioned above) to the MQTT Broker. Figure 4subscribe() in ; then the MQTT Broker forwards the first service request to the server (such as Figure 4 For example, there are currently 10,000 users accessing an interface in their respective browsers at the same time to check the temperature and humidity of the air conditioner.

[0082] Subsequently, after receiving the first service request forwarded by the MQTT Broker, the server performs corresponding processing. For example, the server starts to detect the temperature and humidity changes of the air conditioner; then sends the detected temperature and humidity results (i.e., the above service processing results) to the MQTT Broker. Figure 4 sendReactiveResult() in the MQTT Broker, and then broadcast the obtained business processing results to the corresponding browser, such as Figure 4 in broadcastResult().

[0083] Further, determine the subscription status of the first topic of the target browser, wherein the target browser is any one of the browsers, the first topic is used to represent a specific topic corresponding to the first business request, and the number of first topics is greater than or equal to 1; when the target browser subscribes to the first topic, send topic change data corresponding to the first topic to the target browser through the MQTT Broker.

[0084] In an embodiment of the present application, the MQTT protocol also supports an efficient and scalable message (subscription topic) distribution mechanism, allowing multiple browsers or clients to receive and respond to data changes on the server side in real time. Specifically: First, the system needs to determine whether the target browser (i.e., any browser instance) has subscribed to a topic (first topic) associated with a specific business request (such as the first business request mentioned above), wherein each business request corresponds to one or more specific topics, i.e., the number of the first topics can be 1 or more, and each topic may be for different data or information. If the target browser has subscribed to the first topic, the MQTT Broker will send the topic change data corresponding to the first topic to the browser. These topic change data may be due to the execution results of the business request, such as data updates, event notifications, etc. Through the broadcast mechanism of the MQTT Broker, it is ensured that the target browser can receive the topic change data in real time, thereby updating its display or behavior.

[0085] Application scenario example: If the first business request is to obtain the temperature and humidity data of the air conditioner, the first topic may be home / airconditioner / status. When the status of the air conditioner changes, all browsers subscribed to this topic will receive updates.

[0086] In the above high-concurrency business processing process, the network resources and server resources can be efficiently utilized through the broadcast mechanism of the long connection and MQTT protocol. Among them, the server only needs to process the business request data once, rather than the individual request of each browser, which effectively reduces the load pressure of the server; at the same time, the browser can also implement the change data received from the business request, ensuring the real-time update of the user interface data.

[0087] This high-concurrency business processing strategy can be applied to the following scenarios:

[0088] Smart home: Multiple devices and user interfaces need to obtain environmental data such as temperature, humidity, and air quality in real time.

[0089] Industrial monitoring: Multiple monitoring terminals in a factory need to obtain equipment status and environmental data in real time.

[0090] Real-time notification system: A large number of users need to receive real-time notifications of certain events, such as stock price changes, news push, etc.

[0091] Optionally, the above method also includes: determining a first display result corresponding to the first business request; determining an update operation performed by the target browser on the first display result, and updating the first display result according to the update operation to obtain a second display result; and sending the second display result to other browsers through an MQTT Broker, wherein the other browsers are browsers other than the target browser.

[0092] In the embodiments of the present application, Figure 4 The data transmission process in is also applicable to business processing that actively triggers state synchronization, such as a scenario where an operation actively triggered by a browser needs to affect the state of other browsers. The details are as follows:

[0093] When the server (such as Figure 4 After processing the first service request, the server in the MQTT broker returns the service processing result to multiple browsers (such as Figure 4 The browser displays the first display result on the display interface. The target browser (such as SessionB) can update the received display result according to actual needs to generate an updated second display result. Subsequently, it is broadcasted to all browsers that sent the first service request through MQTTBroker, including other browsers other than the target browser, to ensure that other browsers can also receive this change, realize real-time synchronization of data, and ensure data consistency.

[0094] Application scenario example: Multiple browsers access an alarm list at the same time. When a user changes the alarm status, the server receives the change request, generates an update result after processing, and broadcasts it to all subscribed browsers through MQTTBroker, including the browser that initiated the change and other users' browsers.

[0095] The business processing strategy of actively triggering state synchronization can be applied to the following scenarios:

[0096] Real-time collaboration platform: When multiple users collaborate to edit the same document or project, ensure that each user's interface is synchronized in real time.

[0097] Online games: In multiplayer games, a player's actions or status changes need to be synchronized to all other players in real time.

[0098] Real-time monitoring system: When multiple users monitor the status of equipment or environment at the same time, the operation of any one user needs to be synchronized to other users in real time.

[0099] Optionally, receiving a service request sent by a browser through an MQTT Broker further includes: receiving a second service request sent by a target browser through an MQTT Broker within a second time period, wherein the second service request is used to represent multiple different service requests initiated by the target browser.

[0100] Further, determine the business name, source ID and request ID of the target business request, wherein the target business request is any one of the second business requests; process the target business request according to the business name to obtain a target processing result; and send the target processing result to the target browser through the MQTT Broker for display according to the source ID and request ID.

[0101] Figure 5 FIG. 1 is a schematic diagram of another data transmission process according to an embodiment of the present application. Figure 5 As shown in the figure, this data transmission process is suitable for real-time collaborative business processing, such as a browser interface that brings together multiple different business interfaces and all require high real-time performance. The details are as follows:

[0102] In any time period (i.e., the second time period mentioned above), the target browser (such as Figure 5 SessionB in the session establishes a persistent connection with the MQTT Broker and sends a different service request (i.e., the second service request mentioned above) to the MQTT Broker. Figure 5 The two subscribe() in ; then the MQTT Broker forwards the second service request to the server (such as Figure 5 Server in the process.

[0103] Further, the server determines the Business Name (i.e., the business name), Client ID (i.e., the source ID), and Session ID (i.e., the request ID) of each business request (i.e., the target business request) in the second business request, and processes the target business request according to the Business Name to generate a target processing result, such as Figure 5 Then, according to the Client ID and Session ID of the target business request, the target processing result is broadcast to the target browser through MQTTBroker, such as Figure 5 in broadcastResult().

[0104] In the above-mentioned real-time collaborative business processing, by establishing a single long connection with the MQTT Broker, the server avoids the overhead of processing a large number of short connections, reduces the CPU and memory usage, and at the same time, the long connection also reduces frequent network IO operations, improves the efficiency of data transmission and the stability of the system, and avoids potential problems caused by frequent connection establishment and disconnection. The server no longer needs to maintain multiple client (browser) connections, reducing the frequent connection disconnection problems caused by users frequently switching interfaces, and through the efficient message delivery mechanism of MQTT, it ensures that data can reach each client in real time, meeting the needs of high real-time business scenarios.

[0105] The real-time collaborative business processing strategy can be applied to the following scenarios:

[0106] High-concurrency request processing: Able to effectively handle a large number of concurrent requests, such as online education platforms, live broadcast platforms, etc.

[0107] Smart home systems: Multiple smart devices and user interfaces need to obtain and push data in real time to ensure the efficient operation of the system.

[0108] Comprehensive information display platform: gathers data from multiple different business interfaces, displays temperature, humidity, equipment status and other information in real time, and provides comprehensive monitoring and management functions.

[0109] Optionally, the above method also includes: determining the configuration of the second topic of the server, wherein the second topic is used to receive an offline prompt message sent by the browser; when the server is configured with the second topic, after the browser exits, receiving a prompt message sent by the browser through the MQTT Broker, wherein the prompt message is used to prompt that the browser is in an offline state.

[0110] In the embodiment of the present application, Will Topic (will topic, i.e. the second topic mentioned above) is an important feature in the MQTT protocol, which allows the browser to send a pre-configured prompt message when the connection is abnormally disconnected. Specifically, determine whether the server has subscribed to Will Topic or related topics, where Will Topic is used to receive offline prompt messages from the browser, and the format is usually web / disconnect / {clientId}, where {clientId} is the unique identifier of the client; when the browser client is abnormally disconnected, the MQTT Broker automatically sends a prompt message to the configured Will Topic; after receiving the prompt message, the server parses the clientId and other information in the message, and executes the corresponding logic based on this information to complete the life cycle management of the browser, including but not limited to disconnection, releasing resources, updating database status, etc.

[0111] By establishing a single long connection between the server and the MQTT Broker, and a single long connection between the browser and the MQTT Broker, frequent network IO operations and complex connection management are avoided. Furthermore, through the topic subscription and broadcast mechanism of the MQTT Broker, the browser can efficiently obtain and synchronize real-time data. In addition, by using the Will Topic mechanism to automatically send notifications when the browser is abnormally disconnected, the integrity of connection management is ensured.

[0112] The data display method in the embodiment of the present application also provides the design of three interaction strategies, which are respectively suitable for the scenarios of high-concurrency data acquisition, real-time collaboration, and active triggering of state synchronization. The specific beneficial effects are as follows:

[0113] 1. Reduce server load: The browser does not need to establish too many connections with the server based on the number of business interfaces, which reduces the burden on the server. For example, when multiple browsers want to obtain the same interface data, the server only needs to process it once, avoiding repeated processing.

[0114] 2. Improve data real-time performance: The data stream is actively pushed to the browser by the server to ensure that the data on the browser interface is the latest, reducing the delay and resource waste caused by the browser's regular polling. When a user changes the data, the interfaces of all other users will be updated immediately, ensuring data consistency and real-time performance.

[0115] 3. Simplify connection management: Whether it is a browser or a server, the number of connections will not increase with the increase in the number of business interfaces, reducing the complexity of connection management.

[0116] 4. Enhanced data transmission efficiency and system stability: Through the broadcast mechanism of the MQTT protocol, network resources and server resources can be used efficiently. Long connections reduce frequent network IO operations and improve the efficiency and stability of data transmission. And only one long connection needs to be maintained, which reduces the disconnection problem caused by users frequently switching interfaces, enhances system stability, and avoids potential problems caused by frequent connection establishment and disconnection.

[0117] 5. Reduce maintenance costs: The server no longer needs to maintain multiple client connections, reducing the overhead caused by frequent connections and disconnections. The browser's connection logic is simplified, reducing code complexity and maintenance costs.

[0118] Figure 6 is a flow chart of another method for data display according to an embodiment of the present application. Figure 6 As shown, the method is applied to a browser and includes the following steps:

[0119] Step S602, establishing a persistent connection between the browser and the message queue telemetry transmission agent component MQTT Broker, wherein the MQTT Broker is used to implement data transmission between the server and the browser;

[0120] Step S604, sending a service request to the server through the MQTT Broker;

[0121] Step S606, receiving the business processing result sent by the server through the MQTT Broker, and displaying the business processing result, wherein the business processing result is used to indicate the result after processing the business request.

[0122] It should be noted that the method of data display applied to the browser is similar to the above-mentioned method of data display applied to the server. Therefore, the relevant explanations in the above-mentioned method of data display applied to the server are also applicable to the method of data display applied to the browser, and will not be repeated here.

[0123] According to an embodiment of the present application, a data display device is provided. It should be noted that the data display device of the embodiment of the present application can be used to execute the method for data display provided by the embodiment of the present application. The data display device provided by the embodiment of the present application is introduced below.

[0124] Figure 7 is a structural diagram of a data display device provided according to an embodiment of the present application. Figure 7 As shown, the device is applied to a server and includes:

[0125] The first establishment module 70 is used to establish a long connection between the server and the message queue telemetry transmission agent component MQTT Broker, wherein the MQTT Broker is used to realize data transmission between the server and the browser;

[0126] The receiving module 72 is used to receive the service request sent by the browser through the MQTT Broker, and process the service request to obtain the service processing result;

[0127] The first sending module 74 is used to send the business processing result to the browser through the MQTT Broker for display.

[0128] Through the first establishment module 70, the receiving module 72 and the first sending module 74 in the device shown by the above data, the purpose of data transmission between the server and the browser based on the intermediate proxy component MQTT Broker is achieved, thereby achieving the technical effect of reducing the transmission burden of the server, improving data transmission efficiency and maintaining system stability, and further solving the technical problems of excessive server burden and insufficient data real-time performance due to the direct interaction between the browser and the server when the BS architecture application service in the related technology realizes automatic data refresh.

[0129] In the data display device provided in the embodiment of the present application, the receiving module is also used to receive a first business request sent by the browser through the MQTT Broker within a first time period, wherein the first business request is used to represent the same business request initiated by multiple browsers.

[0130] In the data display device provided in the embodiment of the present application, the receiving module is also used to receive a second business request sent by the target browser through the MQTT Broker within a second time period, wherein the second business request is used to represent multiple different business requests initiated by the target browser.

[0131] In the data display device provided in the embodiment of the present application, the receiving module is also used to determine the configuration status of the second topic of the server, wherein the second topic is used to receive offline prompt messages sent by the browser; when the server is configured with the second topic, after the browser exits, the prompt message sent by the browser through the MQTT Broker is received, wherein the prompt message is used to prompt that the browser is in an offline state.

[0132] In the data display device provided in the embodiment of the present application, the first sending module is also used to determine the subscription status of the first topic of the target browser, wherein the target browser is any one of the browsers, the first topic is used to represent a specific topic corresponding to the first business request, and the number of first topics is greater than or equal to 1; when the target browser subscribes to the first topic, the topic change data corresponding to the first topic is sent to the target browser through the MQTT Broker.

[0133] In the data display device provided in the embodiment of the present application, the first sending module is also used to determine a first display result corresponding to the first business request; determine the update operation performed by the target browser on the first display result, and update the first display result according to the update operation to obtain a second display result; send the second display result to other browsers through the MQTT Broker, wherein the other browsers are browsers other than the target browser.

[0134] In the data display device provided in the embodiment of the present application, the first sending module is also used to determine the service name, source ID and request ID of the target service request, wherein the target service request is any one of the second service requests; process the target service request according to the service name to obtain the target processing result; and send the target processing result to the target browser for display through the MQTT Broker according to the source ID and request ID.

[0135] Figure 8 FIG. 1 is a structural diagram of another data display device provided in an embodiment of the present application. Figure 8 As shown, the device is applied to a browser and includes:

[0136] The second establishment module 80 is used to establish a long connection between the browser and the message queue telemetry transmission agent component MQTT Broker, wherein the MQTT Broker is used to realize data transmission between the server and the browser;

[0137] The second sending module 82 is used to send a service request to the server through the MQTT Broker;

[0138] The display module 84 is used to receive the business processing result sent by the server through the MQTT Broker and display the business processing result, wherein the business processing result is used to represent the result after processing the business request.

[0139] Through the second establishment module 80, the second sending module 82 and the display module 84 in the above-mentioned data display device, the purpose of data transmission between the server and the browser based on the intermediate proxy component MQTT Broker is achieved, thereby achieving the technical effect of reducing the transmission burden of the server, improving data transmission efficiency and maintaining system stability, and further solving the technical problems of excessive server burden and insufficient data real-time performance due to the direct interaction between the browser and the server when the BS architecture application service in the related technology realizes automatic data refresh.

[0140] An embodiment of the present application also provides an electronic device, including: a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the method for realizing the above-mentioned data display.

[0141] It should be noted that the above electronic equipment is used to execute Figure 2 The method of data display shown in the figure, therefore the relevant explanations and instructions in the above data display method are also applicable to the electronic device and will not be repeated here.

[0142] An embodiment of the present application further provides a non-volatile storage medium, which includes a stored computer program, wherein a device where the non-volatile storage medium is located executes the above-mentioned data display method by running the computer program.

[0143] It should be noted that the above non-volatile storage medium is used to execute Figure 2 The method of data display shown in the figure, therefore the relevant explanations in the above data display method are also applicable to the non-volatile storage medium and will not be repeated here.

[0144] An embodiment of the present application also provides a computer program product, including computer instructions, which implement the above-mentioned data display method when executed by a processor.

[0145] It should be noted that the above-mentioned computer program product is used to execute Figure 2 The method of data display shown in the figure, therefore the relevant explanations and instructions in the above data display method are also applicable to the computer program product and will not be repeated here.

[0146] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0147] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0148] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0149] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0150] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0151] If the integrated unit is implemented in the form of 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 application, 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, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0152] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for data presentation, characterized in that: include: Establishing a long connection between the server and the message queue telemetry transmission agent component MQTT Broker, wherein the MQTT Broker is used to realize data transmission between the server and the browser; Receive a service request sent by the browser through the MQTT Broker, and process the service request to obtain a service processing result; The business processing result is sent to the browser through the MQTT Broker for display.

2. The method according to claim 1, characterized in that Receiving a service request sent by the browser through the MQTT Broker, including: A first service request is received, which is sent by the browser through the MQTT Broker within a first time period, wherein the first service request is used to represent the same service request initiated by multiple browsers.

3. The method according to claim 2, characterized in that The method further comprises: Determine a subscription status of a first topic of a target browser, wherein the target browser is any one of the browsers, the first topic is used to represent a specific topic corresponding to the first service request, and the number of the first topics is greater than or equal to 1; In a case where the target browser subscribes to the first topic, topic change data corresponding to the first topic is sent to the target browser through the MQTT Broker.

4. The method according to claim 3, characterized in that The method further comprises: Determine a first display result corresponding to the first service request; Determining an update operation performed by the target browser on the first display result, and updating the first display result according to the update operation to obtain a second display result; The second display result is sent to other browsers through the MQTT Broker, wherein the other browsers are browsers among the browsers except the target browser.

5. The method according to claim 3, characterized in that: Receiving a service request sent by the browser through the MQTT Broker, further comprising: A second service request is received, which is sent by the target browser through the MQTT Broker within a second time period, wherein the second service request is used to represent a plurality of different service requests initiated by the target browser.

6. The method according to claim 5, characterized in that The method further comprises: Determine a service name, a source ID, and a request ID of a target service request, wherein the target service request is any one of the second service requests; Processing the target service request according to the service name to obtain a target processing result; The target processing result is sent to the target browser through the MQTT Broker for display according to the source ID and the request ID.

7. The method according to claim 1, characterized in that The method further comprises: Determine the configuration of a second theme of the server, wherein the second theme is used to receive an offline prompt message sent by the browser; In the case where the server is configured with the second topic, after the browser exits, a prompt message sent by the browser through the MQTT Broker is received, wherein the prompt message is used to prompt that the browser is in an offline state.

8. A method for data presentation, characterized in that: include: Establishing a persistent connection between the browser and a message queue telemetry transmission agent component MQTT Broker, wherein the MQTT Broker is used to implement data transmission between the server and the browser; Sending a service request to the server through the MQTT Broker; Receive the business processing result sent by the server through the MQTT Broker, and display the business processing result, wherein the business processing result is used to represent the result after processing the business request.

9. A device for displaying data, characterized in that: include: The first establishment module is used to establish a long connection between the server and the message queue telemetry transmission agent component MQTT Broker, wherein the MQTT Broker is used to realize data transmission between the server and the browser; A receiving module, used to receive the service request sent by the browser through the MQTT Broker, and process the service request to obtain a service processing result; The first sending module is used to send the business processing result to the browser through the MQTT Broker for display.

10. A device for displaying data, characterized in that: include: The second establishment module is used to establish a long connection between the browser and the message queue telemetry transmission agent component MQTT Broker, wherein the MQTT Broker is used to realize data transmission between the server and the browser; A second sending module, used to send a service request to the server through the MQTT Broker; The display module is used to receive the business processing result sent by the server through the MQTT Broker and display the business processing result, wherein the business processing result is used to represent the result after processing the business request.

11. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the method for data display described in any one of claims 1 to 7 or the method for data display described in claim 8.

12. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the data display method described in any one of claims 1 to 7 or the data display method described in claim 8 by running the computer program.

13. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the method for data presentation described in any one of claims 1 to 7 or the method for data presentation described in claim 8 is implemented.