Information query method and device and electronic equipment

By establishing a long connection between the client and the polling agent, supporting full-duplex communication and multiplexing, it solves the problems of resource waste and performance degradation in the traditional polling method, and realizes efficient information query and flexible development architecture.

CN120670641APending Publication Date: 2025-09-19HANGZHOU ALICLOUD FEITIAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410318182.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-19
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

In traditional web applications, frequent polling requests lead to resource waste and performance degradation on both the client and server sides, and increase development difficulty.

Method used

By establishing the first long connection between the client and the polling agent, full-duplex communication and multiplexing are supported. The client only sends subscription requests to the polling agent, and the polling agent is responsible for querying the server and returning the results, reducing direct polling requests to the server.

Benefits of technology

It improves communication efficiency and real-time performance, saves client and server resources, reduces the difficulty of front-end and back-end development, and provides flexible architecture expansion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120670641A_ABST
    Figure CN120670641A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an information query method and device and electronic equipment. The information query method comprises the steps that a subscription request is sent to a polling agent through a first long connection, the subscription request comprises one or more pieces of to-be-queried interface information, the interface information comprises an interface address and a polling interval, and the first long connection supports full-duplex communication and multiplexing; and receiving a subscription result sent by the polling agent based on the polling interval, wherein the subscription result is obtained from the server based on the interface address. According to the method, resource waste and performance reduction caused by polling are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and more particularly, to an information query method, device, and electronic device. Background Art

[0002] In traditional web applications, polling is often used to query the server for information in order to update data in real time or query the status and results of asynchronous tasks. That is, the client continuously sends polling requests at a certain polling interval to query data changes on the server. However, frequent polling requests will occupy a large amount of client thread resources. In addition, when there are multiple different polling requests, multiple long connections need to be maintained between the client and the server, resulting in resource waste and performance degradation. Summary of the Invention

[0003] The present application provides an information query method, device, and electronic device, which avoids resource waste and performance degradation caused by polling.

[0004] In a first aspect, the present application provides an information query method, comprising:

[0005] Sending a subscription request to the polling agent through the first persistent connection, wherein the subscription request includes one or more interface information to be queried, the interface information including the interface address and the polling interval, and the first persistent connection supports full-duplex communication and multiplexing;

[0006] A subscription result sent by the polling agent based on the polling interval is received, where the subscription result is obtained from the server based on the interface address.

[0007] In one implementation, the interface address includes a path parameter and a query parameter.

[0008] In one implementation, before sending the subscription request to the polling proxy through the first persistent connection, the method further includes:

[0009] A first long connection is established with the polling agent.

[0010] In one implementation, the first long connection is a WebSocket connection, and the polling agent is a Websocket agent.

[0011] In a second aspect, the present application provides an information query method, which is applied to a polling agent, and the method includes:

[0012] receiving a subscription request sent by a client through a first persistent connection, where the subscription request includes one or more interface information to be queried, where the interface information includes an interface address and a polling interval, and the first persistent connection supports full-duplex communication and multiplexing;

[0013] Sending an interface query request to the server based on the interface address and the polling interval;

[0014] Receive the interface query result sent by the server, and send a subscription result to the client based on the interface address and the interface query result.

[0015] In one implementation, the interface address includes a path parameter and a query parameter.

[0016] In one implementation, the sending an interface query request to the server based on the interface address and the polling interval includes:

[0017] Sending the interface query request to the server based on the path parameter in the interface address and the polling interval;

[0018] The sending of the subscription result to the client based on the interface address and the interface query result includes:

[0019] Based on the query parameter in the interface address, a result in the interface query result corresponding to the query parameter is determined as a subscription result, and the subscription result is sent to the client.

[0020] In one implementation, before receiving the subscription request sent by the client through the first persistent connection, the method further includes:

[0021] A first long connection is established with the client.

[0022] In one implementation, the method further includes:

[0023] If the subscription request exceeds a first preset duration or the duration during which the first persistent connection is in an idle state exceeds a second preset duration, the first persistent connection is disconnected.

[0024] In one implementation, the polling agent is provided at the server end, or the polling agent is independent of the server end and has a communication connection with the server end.

[0025] In one implementation, the first long connection is a WebSocket connection, and the polling agent is a Websocket agent.

[0026] In a third aspect, the present application provides an information query device, applied to a client, comprising:

[0027] a sending module, configured to send a subscription request to the polling agent through a first persistent connection, wherein the subscription request includes one or more interface information to be queried, the interface information including an interface address and a polling interval, and the first persistent connection supports full-duplex communication and multiplexing;

[0028] The receiving module is configured to receive a subscription result sent by the polling agent based on the polling interval, wherein the subscription result is obtained from the server based on the interface address.

[0029] In one implementation, the interface address includes a path parameter and a query parameter.

[0030] In one implementation, the apparatus further includes:

[0031] A connection establishment module is used to establish a first long connection with the polling agent.

[0032] In one implementation, the first long connection is a WebSocket connection, and the polling agent is a Websocket agent.

[0033] In a fourth aspect, the present application provides an information query device, which is applied to a polling agent, and the device includes:

[0034] A receiving module, configured to receive a subscription request sent by a client through a first persistent connection, wherein the subscription request includes one or more interface information to be queried, the interface information including an interface address and a polling interval, and the first persistent connection supports full-duplex communication and multiplexing;

[0035] A sending module, configured to send an interface query request to the server based on the interface address and the polling interval;

[0036] The receiving module is used to receive the interface query result sent by the server;

[0037] The sending module is configured to send a subscription result to the client based on the interface address and the interface query result.

[0038] In one implementation, the interface address includes a path parameter and a query parameter.

[0039] In one implementation, the sending module is configured to:

[0040] Sending the interface query request to the server based on the path parameter in the interface address and the polling interval;

[0041] The sending module is used for:

[0042] Based on the query parameter in the interface address, a result in the interface query result corresponding to the query parameter is determined as a subscription result, and the subscription result is sent to the client.

[0043] In one implementation, the apparatus further includes:

[0044] A connection establishment module is used to establish a first long connection with the client.

[0045] In one implementation, the apparatus further includes:

[0046] The disconnection module is used to disconnect the first long connection when the subscription request exceeds a first preset duration or the duration for which the first long connection is in an idle state exceeds a second preset duration.

[0047] In one implementation, the polling agent is provided at the server end, or the polling agent is independent of the server end and has a communication connection with the server end.

[0048] In one implementation, the first long connection is a WebSocket connection, and the polling agent is a Websocket agent.

[0049] In a fifth aspect, the present application provides an electronic device, comprising: a memory and a processor;

[0050] The memory is used to store computer programs;

[0051] The processor is configured to execute a computer program stored in the memory, and when the computer program is run, the processor is enabled to execute the method according to the first aspect or the second aspect.

[0052] In a sixth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the processor executes the method described in the first aspect or the second aspect.

[0053] In a seventh aspect, the present application provides a computer program product, comprising a computer program, which implements the method described in the first aspect or the second aspect when executed by a processor.

[0054] The information query method, device and electronic device provided in the present application implement polling based on the first long connection between the client and the polling agent. The first long connection supports full-duplex communication and multiplexing. Only one long connection needs to be maintained between the client and the polling agent to implement one or more polls, reducing the overhead of connection establishment and disconnection. For each poll, the client only needs to send a corresponding subscription request to the polling agent, without frequently sending polling requests to the server, reducing unnecessary polling requests, thereby improving communication efficiency and real-time performance, saving resources on the client and server, and avoiding performance degradation on the client and server. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0056] Figure 1 This is a schematic diagram of the architecture of an information query method provided in an embodiment of the present application;

[0057] Figure 2 This is a flow diagram of an information query method provided by an embodiment of the present application. Figure 1 ;

[0058] Figure 3 This is a flow diagram of an information query method provided by an embodiment of the present application. Figure 2 ;

[0059] Figure 4 This is a flow diagram of an information query method provided by an embodiment of the present application. Figure 3 ;

[0060] Figure 5 This is a schematic diagram of the structure of an information query device provided in an embodiment of the present application. Figure 1 ;

[0061] Figure 6 This is a schematic diagram of the structure of an information query device provided in an embodiment of the present application. Figure 2 ;

[0062] Figure 7 It is a schematic block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0063] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0064] The following describes the terms used in the embodiments of the present application.

[0065] Polling: A common web application communication method that continuously sends requests to query for updates on data or task status.

[0066] Websocket: A network protocol that provides full-duplex communication, allowing two-way communication over a single TCP connection and higher real-time performance than HTTP.

[0067] Multiplexing: A technique for transmitting multiple data streams simultaneously over a single TCP connection, which can reduce network overhead and improve communication efficiency.

[0068] Java server-side: refers to the server-side program that runs in the Java programming language.

[0069] Proxy: A type of middleware that acts as an intermediary between the client and the server, forwarding requests and responses and providing additional functionality and optimization.

[0070] HTTP request thread: A thread that processes HTTP requests in a web application. If too many polling requests occupy these threads, it will lead to resource waste and performance degradation.

[0071] Communication protocol: defines the rules and formats for data exchange between communicating parties.

[0072] Subscribe: Indicates that the client requests the server to update in real time or receive specific data.

[0073] API URL: This refers to the address of a specific API in a web application.

[0074] Polling interval: Specifies the time interval between polling requests, that is, how often polling is performed.

[0075] Metadata query: Use built-in monitoring and logging capabilities to query the current WebSocket connection status, subscribed interface information, connection time, and other information.

[0076] Heartbeat: A periodic message sent between the client and the server to ensure the activity and stability of the connection.

[0077] Data compression: By using compression algorithms to reduce the size of data transmission, network transmission efficiency is improved.

[0078] Protocol Buffers format: A data serialization format that can be used to efficiently compress and transmit data.

[0079] Authentication: The process of verifying the identity and permissions of a user or client to protect system and data security.

[0080] In traditional polling methods, frequent polling requests consume a large amount of client thread resources. Furthermore, when multiple different polling operations are in progress, multiple persistent connections must be maintained between the client and server, resulting in wasted resources and reduced performance. Furthermore, maintaining such polling code increases development complexity for front-end developers. For server-side developers, since polling requests often target more specific information within the server's API, supporting each specific polling request may require modifying the existing code and adding interfaces that adapt to polling requests, further increasing development complexity.

[0081] In order to solve the above problems, the embodiment of the present application proposes an information query method based on polling agent, such as Figure 1 As shown in , a front-end application runs in the client, and the front-end application can be in the form of a browser or a mobile client, and a back-end application runs on the server, and the server can be called an application server. The back-end application in the embodiment of the present application can be a Java server. The polling agent can be set in the server, that is, the polling agent is a service or module in the server, and the server includes the polling agent and the back-end application, or the polling agent can be independent of the server and there is a communication connection between the server. It should be noted that, in the case where the polling agent is set on the server, the interaction between the polling agent and the server described in the embodiment of the present application refers to the interaction between the polling agent and the back-end application in the server.

[0082] A first long connection can be established between the client and the polling agent. The first long connection supports full-duplex communication and multiplexing. Different polling can be achieved through the first long connection without establishing multiple connections. The client sends a subscription request to the polling agent to subscribe to the interface information that needs to be polled. The polling agent polls the corresponding interface in the server, and the client does not need to send requests frequently. For front-end developers, they only need to subscribe to the interface that needs to be polled according to the communication protocol, which greatly reduces the difficulty of development. For server developers, the polling agent queries the server's interface, and then returns the information in the interface query result required by the client to the client based on the interface query result. The server does not need to add interfaces to adapt to specific polling requests, and there is no need to change the original code.

[0083] Figure 2 This is a flow diagram of an information query method provided by an embodiment of the present application. Figure 1 .like Figure 2 As shown, the method includes:

[0084] S201. The client sends a subscription request to the polling proxy through a first persistent connection.

[0085] The subscription request includes one or more interface information to be queried, and the interface information includes the interface address and the polling interval. The first long connection supports full-duplex communication and multiplexing.

[0086] Each interface information in the subscription request indicates a polling object. The polling object can be the target interface or the target information in the target interface. The target interface is the interface for querying information on the server side. For example, the target interface is an interface for querying data, and the target information in the target interface is a data field returned by the interface for querying data. The target interface is an interface for querying task information, and the target information in the target interface is a certain task information returned by the interface for querying task information, such as task status. For the client, different polls can be subscribed through multiple interface information in one subscription request, or can be subscribed through multiple subscription requests. The first long connection supports multiplexing, and different subscription requests can be sent based on the first long connection.

[0087] The interface information includes the interface address and the polling interval. The interface address is used to indicate the target interface or the target information in the target interface, and the polling interval is used to indicate the time interval for the polling agent to query the server. The polling interval can be set according to specific needs, for example, the polling interval is 1s, 3s, 5s, 10s, 30s, 60s, etc. Optionally, the interface address includes path parameters and query parameters. For example, the interface address is the Uniform Resource Locator (URL) of the interface, and the URL contains path parameters and query parameters. The path parameters correspond to the interface for querying information provided by the server, that is, the target interface, and the query parameters correspond to part or all of the data returned by the target interface, that is, the target information. For example, the path parameters correspond to the product information interface on the server, and the query parameters correspond to the product inventory in the product information returned by the product information interface. For example, the path parameters correspond to the task details interface on the server, and the query parameters correspond to the task status in the task details returned by the task details interface.

[0088] S202: The polling agent sends an interface query request to the server based on the interface address and the polling interval.

[0089] Based on the target interface indicated in the interface address, the polling agent sends an interface query request to the server for the target interface. For example, if the interface address includes both path and query parameters, the polling agent sends an interface query request to the server based on the path parameter in the interface address and the polling interval in the interface information. For example, if the target interface corresponding to the path parameter is the product information interface and the polling interval is 10 seconds, the polling agent will send an interface query request to the server for this product information interface every 10 seconds.

[0090] S203: The server sends the interface query result to the polling agent.

[0091] The server receives the interface query request, obtains the corresponding information based on the interface query request, and returns it to the polling agent as the interface query result. For example, the target interface is the product information interface, and the interface query result of the product information interface includes product information such as product price and product inventory.

[0092] S204: The polling agent sends a subscription result to the client based on the interface address and the interface query result.

[0093] Based on the polled object indicated in the interface information and the interface query result returned by the server, the polling agent sends part or all of the information in the interface query result as a subscription result to the client via the first persistent connection. For example, if the interface address includes path parameters and query parameters, the polling agent determines the result in the interface query result corresponding to the query parameters as the subscription result based on the query parameters in the interface address, and sends the subscription result to the client.

[0094] For example, the target interface corresponding to the path parameter in the interface information is the product information interface, and the query parameter corresponds to the product inventory in the interface query result returned by the product information interface. After the server returns the interface query result containing product information such as product price and product inventory, the polling agent returns the product price as the subscription result to the client.

[0095] It can be understood that the polling agent sends an interface query request to the server according to the query interval. Accordingly, after receiving each interface query request, the server sends the corresponding interface query result to the polling agent. For the client, it will receive the subscription result sent by the polling agent based on the query interval.

[0096] The information query method provided in the embodiment of the present application implements polling based on the first long connection between the client and the polling agent. The first long connection supports full-duplex communication and multiplexing. Only one long connection needs to be maintained between the client and the polling agent to implement one or more polls, thereby reducing the overhead of connection establishment and disconnection. For each poll, the client only needs to send a corresponding subscription request to the polling agent, without frequently sending polling requests to the server, thereby reducing unnecessary polling requests, thereby improving communication efficiency and real-time performance, saving resources of the client and server, and avoiding performance degradation of the client and server.

[0097] Furthermore, by introducing a polling proxy, front-end applications are isolated from back-end application servers, providing more flexible architecture expansion and management. For front-end developers, they only need to subscribe to the polling interface according to the communication protocol, greatly reducing development complexity. For server-side developers, the polling proxy queries the server's existing interface and then returns the required information to the client based on the interface query results. The server does not need to add interfaces to adapt to specific polling requests, nor does it need to change the existing code.

[0098] Optionally, the first long connection in real time of this application is a WebSocket connection, and the polling agent is a Websocket agent, that is, the client sends a subscription request to the polling agent through the WebSocket connection, the Websocket agent sends an interface query request to the server based on the interface address and the polling interval, the server sends the interface query result to the polling agent, and the polling agent sends the subscription result to the client based on the interface address and the interface query result.

[0099] In the method of the embodiment of the present application, before S201, the following steps may be further included:

[0100] S200: Establish a first long connection between the client and the polling proxy.

[0101] The client can send multiple subscription requests to the polling proxy through the first long connection. That is, S200 is not necessarily executed before the client sends the subscription request. After establishing the first long connection through S200, the client can execute S201 multiple times to trigger subsequent corresponding steps.

[0102] When the first persistent connection is a WebSocket connection and the polling proxy is a WebSocket proxy, a WebSocket connection is established between the client and the WebSocket proxy. The process of establishing a WebSocket connection between the client and the WebSocket proxy can be found in related art and will not be described here. The authentication process can also be found in related art.

[0103] To ensure the viability of the first persistent connection, the client and the polling proxy use heartbeat messages to check and confirm. During communication, if an anomaly occurs, such as a connection loss, the polling proxy attempts to reestablish the connection. Alternatively, in the event of a service anomaly, the polling proxy can notify the client of the anomaly through the first persistent connection. For example, in a WebSocket connection, the client and WebSocket proxy use heartbeat messages to confirm the connection's viability. If the connection is lost, the WebSocket proxy can attempt to reestablish the WebSocket connection with the client.

[0104] Optionally, after sending a subscription request to the polling proxy, the client may also send a cancellation request through the first persistent connection according to actual circumstances to stop polling the corresponding interface.

[0105] Optionally, the client may also send a metadata query request to the polling proxy through the first persistent connection to query metadata information such as the subscribed interface, the last call time of the interface, and the last heartbeat time.

[0106] Optionally, to avoid polling from occupying resources for a long time, the polling agent disconnects the first persistent connection with the client when the subscription request exceeds a first preset duration or the first persistent connection is idle for longer than a second preset duration.

[0107] Wherein, "a subscription request exceeding a first preset duration" means that a first preset duration is set for a subscription request. If the client does not send a cancel subscription request after sending a subscription request for more than the first preset duration, the polling agent may trigger the disconnection of the first persistent connection to stop polling. "The first persistent connection being idle for longer than a second preset duration" means that no data is transmitted on the first persistent connection for longer than the second preset duration. In this case, the polling agent may trigger the disconnection of the first persistent connection to release network resources.

[0108] Optionally, in an embodiment of the present application, a data compression algorithm can be used in the messages transmitted between the client and the polling agent through the first long connection to reduce the amount of data transmitted and improve transmission efficiency. For example, the Protobuf format can be used for data transmission.

[0109] Figure 3 This is a flow diagram of an information query method provided by an embodiment of the present application. Figure 2 This method is applied to the client, such as Figure 3 As shown, the method includes:

[0110] S301. Send a subscription request to a polling agent through a first long connection, wherein the subscription request includes one or more interface information to be queried, and the interface information includes an interface address and a polling interval. The first long connection supports full-duplex communication and multiplexing.

[0111] S302: Receive a subscription result sent by the polling agent based on a polling interval, where the subscription result is obtained from the server based on the interface address.

[0112] In the embodiments of the present application, the method executed by the client can refer to the description of the aforementioned embodiments and will not be repeated here.

[0113] Figure 4 This is a flow diagram of an information query method provided by an embodiment of the present application. Figure 3 This method is used for polling agents, such as Figure 4 As shown, the method includes:

[0114] S401: Receive a subscription request sent by a client through a first persistent connection. The subscription request includes one or more interface information to be queried. The interface information includes an interface address and a polling interval. The first persistent connection supports full-duplex communication and multiplexing.

[0115] S402: Send an interface query request to the server based on the interface address and polling interval.

[0116] S403: Receive the interface query result sent by the server, and send the subscription result to the client based on the interface address and the interface query result.

[0117] In the embodiment of the present application, the method of executing the polling agent can refer to the description of the aforementioned embodiment and will not be repeated here.

[0118] Figure 5 This is a schematic diagram of the structure of an information query device provided in an embodiment of the present application. Figure 1 The device is used on the client side, such as Figure 5 As shown, the information query device 500 includes:

[0119] The sending module 501 is used to send a subscription request to the polling agent through the first long connection, wherein the subscription request contains one or more interface information to be queried, and the interface information includes the interface address and the polling interval. The first long connection supports full-duplex communication and multiplexing.

[0120] The receiving module 502 is configured to receive a subscription result sent by the polling agent based on a polling interval, where the subscription result is obtained from the server based on the interface address.

[0121] In one implementation, the interface address includes a path parameter and a query parameter.

[0122] In one implementation, the information query device 500 further includes:

[0123] The connection establishment module 503 is configured to establish a first long connection with the polling agent.

[0124] In one implementation, the first long connection is a WebSocket connection, and the polling agent is a Websocket agent.

[0125] The device of the embodiment of the present application can be used to execute the information query method in the aforementioned embodiment. Its implementation principle and technical effects are similar and will not be repeated here.

[0126] Figure 6 This is a schematic diagram of the structure of an information query device provided in an embodiment of the present application. Figure 2 This device is used for polling agents, such as Figure 6 As shown, the information query device 600 includes:

[0127] A receiving module 601 is configured to receive a subscription request sent by a client through a first persistent connection. The subscription request includes information about one or more interfaces to be queried, including an interface address and a polling interval. The first persistent connection supports full-duplex communication and multiplexing.

[0128] A sending module 602 is configured to send an interface query request to a server based on the interface address and the polling interval;

[0129] Receiving module 601, used to receive the interface query result sent by the server;

[0130] The sending module 602 is configured to send a subscription result to the client based on the interface address and the interface query result.

[0131] In one implementation, the interface address includes a path parameter and a query parameter.

[0132] In one implementation, the sending module 602 is configured to:

[0133] Based on the path parameters and polling interval in the interface address, an interface query request is sent to the server;

[0134] The sending module 602 is used to:

[0135] Based on the query parameters in the interface address, the result corresponding to the query parameters in the interface query result is determined as the subscription result, and the subscription result is sent to the client.

[0136] In one implementation, the information query device 600 further includes:

[0137] The connection establishment module 603 is configured to establish a first persistent connection with the client.

[0138] In one implementation, the information query device 600 further includes:

[0139] The disconnection module 604 is configured to disconnect the first persistent connection with the client when the subscription request exceeds a first preset duration or the duration for which the first persistent connection is in an idle state exceeds a second preset duration.

[0140] In one implementation, the polling agent is provided at the server, or the polling agent is independent of the server and has a communication connection with the server.

[0141] In one implementation, the first long connection is a WebSocket connection, and the polling agent is a WebSocket agent.

[0142] The device of the embodiment of the present application can be used to execute the information query method in the aforementioned embodiment. Its implementation principle and technical effects are similar and will not be repeated here.

[0143] Figure 7 Schematic block diagram of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device 700 may include at least one processor 701 for implementing the information query method provided in the embodiment of the present application.

[0144] Optionally, the electronic device 700 further includes at least one memory 702 for storing program instructions and / or data. The memory 702 is coupled to the processor 701. The coupling in the embodiments of the present application is an indirect coupling or communication connection between devices, units, or modules, which can be electrical, mechanical, or other forms, and is used for information exchange between devices, units, or modules. The processor 701 may operate in conjunction with the memory 702. The processor 701 may execute program instructions stored in the memory 702. At least one of the at least one memory may be included in the processor.

[0145] Optionally, the electronic device 700 further includes a communication interface 703 for communicating with other devices via a transmission medium, thereby enabling the electronic device 700 to communicate with other devices. The communication interface 703 may be, for example, a transceiver, an interface, a bus, a circuit, or a device capable of implementing transceiver functions. The processor 701 may utilize the communication interface 703 to transmit and receive data and / or information, and to implement the methods provided in the embodiments of the present application. For details, please refer to the detailed description in the preceding embodiments, which will not be repeated here.

[0146] The specific connection medium between the processor 701, the memory 702 and the communication interface 703 is not limited in the embodiment of the present application. Figure 7 The processor 701, the memory 702 and the communication interface 703 are connected via a bus 704. The bus 704 is connected to the Figure 7 The connections between the other components are shown in bold lines, which are only for illustration and not intended to be limiting. The bus can be divided into address bus, data bus, control bus, etc. Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0147] It should be understood that the processor in the embodiments of the present application can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above-mentioned method embodiment can be completed by hardware integrated logic circuits in the processor or by software instructions. The above-mentioned processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above-mentioned method.

[0148] It should also be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0149] The present application also provides a computer-readable storage medium storing a computer program (also referred to as code or instruction). When the computer program is executed by a processor, the computer executes the method in any of the aforementioned embodiments.

[0150] The present application also provides a computer program product, including a computer program, which implements the method in any of the aforementioned embodiments when executed by a processor.

[0151] The terms "unit," "module," and the like used in this specification may be used to refer to a computer-related entity, hardware, firmware, a combination of hardware and software, software, or software in execution.

[0152] Those skilled in the art will appreciate that the various illustrative logical blocks and steps described in conjunction with the embodiments disclosed herein can be implemented using electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application. In the several embodiments provided in this application, it should be understood that the disclosed devices, equipment, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not performed. In addition, the coupling or direct coupling or communication connection shown or discussed can be through some interface, indirect coupling or communication connection of devices or units, and can be electrical, mechanical, or other forms.

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

[0154] 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.

[0155] In the above-described embodiments, the functions of each functional unit can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions (programs). When the computer program instructions (program) are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state disk (SSD)).

[0156] If this function 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, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.

[0157] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0158] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. An information query method, characterized in that: Applied to the client, including: Sending a subscription request to the polling agent through the first persistent connection, wherein the subscription request includes one or more interface information to be queried, the interface information including the interface address and the polling interval, and the first persistent connection supports full-duplex communication and multiplexing; A subscription result sent by the polling agent based on the polling interval is received, where the subscription result is obtained from a server based on the interface address.

2. The method according to claim 1, characterized in that The interface address includes path parameters and query parameters.

3. The method according to claim 1, characterized in that Before sending the subscription request to the polling proxy through the first long connection, the method further includes: A first long connection is established with the polling agent.

4. The method according to any one of claims 1 to 3, characterized in that The first long connection is a WebSocket connection, and the polling agent is a Websocket agent.

5. An information query method, characterized in that: Applies to polling agents, including: receiving a subscription request sent by a client through a first persistent connection, where the subscription request includes one or more interface information to be queried, where the interface information includes an interface address and a polling interval, and the first persistent connection supports full-duplex communication and multiplexing; Sending an interface query request to the server based on the interface address and the polling interval; The interface query result sent by the server is received, and a subscription result is sent to the client based on the interface address and the interface query result.

6. The method according to claim 5, characterized in that The interface address includes path parameters and query parameters.

7. The method according to claim 6, characterized in that The sending an interface query request to the server based on the interface address and the polling interval includes: Sending the interface query request to the server based on the path parameter in the interface address and the polling interval; The sending the subscription result to the client based on the interface address and the interface query result includes: Based on the query parameter in the interface address, a result in the interface query result corresponding to the query parameter is determined as a subscription result, and the subscription result is sent to the client.

8. The method according to claim 5, characterized in that Before receiving the subscription request sent by the client through the first persistent connection, the method further includes: A first long connection is established with the client.

9. The method according to claim 5, characterized in that The method further comprises: If the subscription request exceeds a first preset duration or the duration during which the first persistent connection is in an idle state exceeds a second preset duration, the first persistent connection is disconnected.

10. The method according to claim 5, characterized in that The polling agent is set at the server end, or the polling agent is independent of the server end and has a communication connection with the server end.

11. The method according to any one of claims 5 to 10, characterized in that The first long connection is a WebSocket connection, and the polling agent is a Websocket agent.

12. An information query device, characterized in that: Applied to the client, including: a sending module, configured to send a subscription request to the polling agent through a first persistent connection, wherein the subscription request includes one or more interface information to be queried, the interface information including an interface address and a polling interval, and the first persistent connection supports full-duplex communication and multiplexing; The receiving module is configured to receive a subscription result sent by the polling agent based on the polling interval, wherein the subscription result is obtained from the server based on the interface address.

13. An information query device, characterized in that: Applied to a polling agent, the device includes: A receiving module, configured to receive a subscription request sent by a client through a first persistent connection, wherein the subscription request includes one or more interface information to be queried, the interface information including an interface address and a polling interval, and the first persistent connection supports full-duplex communication and multiplexing; A sending module, configured to send an interface query request to a server based on the interface address and the polling interval; The receiving module is used to receive the interface query result sent by the server; The sending module is configured to send a subscription result to the client based on the interface address and the interface query result.

14. An electronic device, characterized in that: include: memory and processor; The memory is used to store computer programs; The processor is configured to execute a computer program stored in the memory, and when the computer program is executed, the processor is enabled to execute the method according to any one of claims 1 to 11.

15. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 11.

16. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 11 when being executed by a processor.