One-way connection method, equipment, medium and product
By generating a private topic to establish a one-way connection, the confusion caused by multiple second terminals in the prior art requesting connections is solved, and the connection success rate and parameter configuration success rate are improved.
Patent Information
- Application Number
- CN202411896669.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-12-23
AI Technical Summary
In the prior art, when multiple second terminals simultaneously send a one-way connection request to the first terminal, the one-way connection request received by the first terminal will be confusing, resulting in a low success rate of connection failure and parameter configuration or modification. .
By generating private topics (third topic and fourth topic) to establish a one-way connection, ensuring that only the first and second terminals know these private topics, thus avoiding the influence of other terminals.
Improves the success rate of one-way connection and the success rate of parameter configuration or modification, and avoids connection failure caused by multiple terminal request conflicts.
Smart Images

Figure CN119485793A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a one-way connection method, device, medium and product. Background Art
[0002] One-way connections are generally used for remote modification or configuration, for example, modifying or configuring the parameters of the first terminal through the second terminal, where the second terminal is a nearby terminal and the user can establish a one-way connection with the first terminal through the client installed on it. The first terminal can be a remote computer, server or any device in the network, and the second terminal can remotely configure or modify the parameters of the first terminal through network communication.
[0003] Currently, most one-way connections are implemented through the MQTT communication protocol, and remote configuration or modification is performed after the connection is successful. The process is as follows: the first terminal requests to subscribe to the first topic, the second terminal requests to subscribe to the second topic, the MQTT server stores the first topic and the second topic, and the MQTT server provides message forwarding function through the first topic and the second topic; the second terminal sends a one-way connection request to the MQTT server, and the one-way connection request carries the first topic, the second topic and configuration parameters; the MQTT server forwards the one-way connection request to the first terminal that has subscribed to the first topic; after receiving the one-way connection request, the first terminal configures or modifies the relevant parameters of the first terminal according to the configuration parameters.
[0004] It can be seen from the above content that the prior art has at least the following technical problems: when multiple second terminals simultaneously send unidirectional connection requests to the first terminal, the unidirectional connection requests received by the first terminal will be confused. For example, the second terminal A requests to connect to the first terminal to modify parameter a, and at the same time, the second terminal B also requests to connect to the first terminal to modify parameter a. At this time, the connection request of at least one of the first terminal A or the second terminal B will fail, and of course the request to modify parameter a will also fail. Obviously, the success rate of unidirectional connection and the success rate of parameter configuration or modification in the prior art are both low. Summary of the invention
[0005] The purpose of this application is to provide a one-way connection method, device, medium and product to solve the problems described in the background technology.
[0006] To achieve the above objectives, this application provides the following solutions:
[0007] In a first aspect, the present application provides a unidirectional connection method, applied to a first terminal, comprising:
[0008] receiving a one-way connection request, the one-way connection request being generated by the second terminal and being used to request to establish a one-way connection with the first terminal through a well-known topic, the well-known topic comprising a first topic and a second topic;
[0009] In response to the unidirectional connection request, checking a current connection status of the first terminal itself;
[0010] When the connection state is an idle state, generating a private topic, the private topic including a third topic and a fourth topic, the third topic and the fourth topic are different from the first topic and the second topic, and the idle state is used to indicate that the first terminal is not connected to any terminal;
[0011] Based on the third topic and the fourth topic, generating a use instruction, the use instruction is used to instruct the second terminal to publish a message using the fourth topic, and the first terminal to reply a message to the second terminal using the third topic;
[0012] The use instruction is sent to the second terminal, so that the second terminal establishes a one-way connection with the first terminal through the third theme and the fourth theme.
[0013] Optionally, after sending the use instruction to the second terminal, the method further includes:
[0014] Sending a third topic subscription request to the one-way connection server; wherein the one-way connection server is used to: receive a configuration request generated by the second terminal, and send the configuration request to the first terminal subscribed to the third topic, the configuration request carries the third topic and configuration content, and the configuration request is used to request configuration parameters of the first terminal;
[0015] The configuration request is received, and configuration is performed based on the configuration content.
[0016] Optionally, the configuration request further carries the fourth topic, and after receiving the configuration request and performing configuration based on the configuration content, the method further includes:
[0017] When the first terminal is configured successfully, a configuration success reminder is generated and sent to the one-way connection server; wherein the configuration success reminder carries the third topic and the fourth topic; the one-way connection server is also used to send the configuration success reminder to the second terminal subscribed to the fourth topic, so that the second terminal knows that the first terminal subscribed to the third topic is successfully configured.
[0018] Optionally, after receiving the configuration request and performing configuration based on the configuration content, the method further includes:
[0019] If the configuration is successful, the unidirectional connection between the second terminal and the first terminal is disconnected, and the third topic and the fourth topic are released.
[0020] Optionally, the connection state further includes non-idle, and after checking the current connection state of the first terminal itself, the method further includes:
[0021] When the connection state is non-idle, a non-idle state reminder is generated, and the non-idle state reminder is sent to a one-way connection server, so that the one-way connection server forwards the non-idle state reminder to the second terminal.
[0022] Optionally, after generating a non-idle state reminder and sending the non-idle state reminder to a one-way connection server, the method further includes:
[0023] Acquire a timestamp carried by a third terminal when interacting with the first terminal most recently, the third terminal being a terminal that is in a connected state with the first terminal at that time;
[0024] Monitoring the interval between the timestamp and the current time;
[0025] When the interval duration is greater than a predetermined duration, the unidirectional connection between the third terminal and the first terminal is disconnected.
[0026] In a second aspect, the present application provides a unidirectional connection method, applied to a second terminal, comprising:
[0027] Sending a one-way connection request, wherein the one-way connection request is used to request to establish a one-way connection with the first terminal through a publicly known topic, and enable the first terminal to generate a private topic, and forward the private topic to the second terminal through a one-way connection server, wherein the publicly known topic includes a first topic and a second topic, and the private topic includes a third topic and a fourth topic;
[0028] Receiving the third topic and the fourth topic forwarded by the one-way connection server;
[0029] Sending a subscription request to the unidirectional connection server to subscribe to the fourth topic;
[0030] A configuration request is generated and sent to the one-way connection server, wherein the configuration request carries the third topic, the fourth topic and configuration content, and the configuration request is used to request configuration of the first terminal subscribing to the fourth topic according to the configuration content.
[0031] In a third aspect, the present application provides a terminal device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any one of the methods described in the first aspect above.
[0032] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any one of the methods described in the first aspect above.
[0033] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any one of the methods in the first aspect.
[0034] According to the specific embodiments provided in this application, this application discloses the following technical effects:
[0035] The one-way connection method based on the one-way connection server provided in the embodiment of the present application, when the first terminal receives the one-way connection request, a new topic will be generated, that is, the private topic, the third topic and the fourth topic. The private topic is different from the known topic. The private topic is only known to the first terminal and the second terminal, and other terminals are not aware of it. Therefore, the first terminal and the second terminal can use these two private topics to perform one-way connection without being affected by other terminals, thereby improving the success rate of the one-way connection, and then also improving the success rate of parameter configuration or modification. With respect to the prior art, each second terminal uses a known topic when performing a one-way connection with the first terminal, which is easily affected by other terminals, resulting in the failure of the one-way connection. Therefore, compared with the prior art, the one-way connection method provided in the embodiment of the present application can improve the success rate of the one-way connection, thereby improving the success rate of parameter configuration or modification. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 This is an application environment diagram of a one-way connection method in an embodiment of the present application;
[0038] Figure 2 A schematic diagram of a flow chart of a one-way connection method provided in one embodiment of the present application;
[0039] Figure 3 A flowchart of a method for configuring based on a unidirectional connection provided in an embodiment of the present application;
[0040] Figure 4 A flowchart of a method for configuring based on a unidirectional connection provided in another embodiment of the present application;
[0041] Figure 5A schematic diagram of a flow chart of a one-way connection method provided in one embodiment of the present application;
[0042] Figure 6 A schematic diagram of a flow chart of a one-way connection method provided in another embodiment of the present application;
[0043] Figure 7 A schematic diagram of a flow chart of a one-way connection method provided in another embodiment of the present application;
[0044] Figure 8 A schematic diagram of a flow chart of a one-way connection method provided in another embodiment of the present application;
[0045] Fig. 9 A schematic diagram of the structure of a terminal device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions 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 are within the scope of protection of this application.
[0047] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0048] The one-way connection method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the application environment includes a first terminal, a second terminal and a one-way connection server. Among them, the first terminal and the second terminal both communicate with the one-way connection server through the network. The data storage system can store the data that the one-way connection server needs to process. The data storage system can be set up separately, or it can be integrated on the one-way connection server, or it can be placed on the cloud or other servers. The second terminal can send a connection request to the one-way connection server, which is then forwarded to the first terminal by the one-way connection server. The first terminal is the terminal that needs to be connected, and after being connected, the second terminal can request to modify the configuration parameters of the first terminal. The one-way connection server can feed back the connection results and configuration results to the second terminal.
[0049] The first terminal is a terminal device that can be connected to multiple second terminals, such as a smart meter. The second terminal can be, but is not limited to, various desktop computers, laptops, smart phones, tablet computers, IoT devices and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The one-way connection server can be implemented with an independent server or a server cluster consisting of multiple servers, or a cloud server.
[0050] In an exemplary embodiment, Figure 2 As shown, a one-way connection method is provided, which is applied to Figure 1 In the environment shown, the first terminal executes the following steps 201 to 205:
[0051] Step 201: A first terminal receives a one-way connection request, where the one-way connection request is generated by a second terminal and is used to request to establish a one-way connection with the first terminal through a well-known topic, where the well-known topic includes a first topic and a second topic.
[0052] Among them, the first terminal subscribes to the first topic, and the second terminal subscribes to the second topic. The first terminal and the second terminal will first send the message that needs to be sent to each other to the one-way connection server, and carry the first topic and the second topic in the message, and then the one-way connection server will forward it to the other party based on the first topic and the second topic.
[0053] In an embodiment of the present application, a one-way connection request is generated by the second terminal and sent to a one-way connection server. The one-way connection server stores a first topic and a second topic. After receiving a message carrying the first topic and the second topic, the one-way connection server determines the topic subscribed to by the terminal that published the message. In the present application, the message is published by the second terminal that subscribes to the second topic, so the first terminal that subscribes to the first topic is the message recipient. Therefore, the one-way connection request will not be forwarded to the second terminal, but will be forwarded to the first terminal. It can be seen that the one-way connection server serves as a one-way connection bridge between the second terminal and the first terminal.
[0054] Among them, the publicly known topic is a topic that can be known by any terminal.
[0055] Furthermore, the one-way connection server may be a message queue telemetry transport (English full name: Message Queuing Telemetry Transport; English abbreviation: MQTT) server.
[0056] In the present application, each first terminal can establish a one-way connection with multiple second terminals. The first terminal can be a PLC, an intelligent collection gateway, a smart meter, etc., and a first client is installed in the first terminal. A second client is installed in the second terminal, and the second client establishes a one-way connection with a one-way connection server through the second terminal, and the one-way connection server then establishes a one-way connection with the first terminal through the first client.
[0057] For example, the first terminal is a smart meter and the second terminal is a mobile phone. Assuming that the smart meter is a meter corresponding to a household in a unit building, all users living in the household can install the second client in their mobile phones and establish a one-way connection with the one-way connection server and the first terminal through the second client to modify the parameters of the smart meter, such as modifying the automatic renewal amount. For example, before the modification, when the remaining amount of the household's electricity is 10 yuan, the automatic renewal is 50 yuan. After the modification, when the remaining amount of the household's electricity is 10 yuan, the automatic renewal is 100 yuan. Of course, another user of the household can also modify the parameters of the smart meter through the client in his mobile phone.
[0058] Step 202: In response to the unidirectional connection request, the first terminal checks its current connection status.
[0059] Among them, any terminal is any terminal that may establish a unidirectional connection with the first terminal.
[0060] Of course, the connection state may be idle or non-idle, and non-idle means that the first terminal is connected to a certain terminal at the current time.
[0061] Step 203, when the connection state is an idle state, the first terminal generates a private topic, the private topic includes a third topic and a fourth topic, the third topic and the fourth topic are different from the first topic and the second topic, and the idle state is used to indicate that the first terminal is not connected to any terminal.
[0062] Among them, the private topic is a topic that only the first terminal and the second terminal know each other, but no other terminal knows it. Therefore, after the private topic is generated, the first terminal and the second terminal can establish a one-way connection through the third topic and the fourth topic without being affected by other terminals.
[0063] The fact that the third theme and the fourth theme are different from the first theme and the second theme can be understood as: the third theme, the fourth theme, the first theme, and the second theme are all different from each other.
[0064] Step 204: Based on the third topic and the fourth topic, the first terminal generates a usage instruction, wherein the usage instruction is used to instruct the second terminal to publish a message using the fourth topic, and the first terminal to reply a message to the second terminal using the third topic.
[0065] After the first terminal generates the third and fourth topics, it is necessary to assign these two topics to the first and second terminals to clarify the users of the two topics to avoid confusion during use. In this application, the user of the third topic is the first terminal, and the user of the fourth topic is the second terminal. Therefore, the second terminal uses the fourth topic to publish a message, and the first terminal uses the third topic to reply to the second terminal.
[0066] Step 205: The first terminal sends the use instruction to the second terminal, so that the second terminal establishes a one-way connection with the first terminal through the third theme and the fourth theme.
[0067] After the usage instruction is generated, it still needs to be forwarded to the second terminal through the one-way connection server. Therefore, step 205 can be specifically: the first terminal sends the usage instruction to the one-way connection server, and the one-way connection server forwards the usage instruction to the second terminal.
[0068] The one-way connection method based on the one-way connection server provided in the embodiment of the present application, when the first terminal receives the one-way connection request, a new topic will be generated, that is, the private topic, the third topic and the fourth topic. The private topic is different from the known topic. The private topic is only known to the first terminal and the second terminal, and other terminals are not aware of it. Therefore, the first terminal and the second terminal can use these two private topics to perform one-way connection without being affected by other terminals, thereby improving the success rate of the one-way connection, and then also improving the success rate of parameter configuration or modification. With respect to the prior art, each second terminal uses a known topic when performing a one-way connection with the first terminal, which is easily affected by other terminals, resulting in the failure of the one-way connection. Therefore, compared with the prior art, the one-way connection method provided in the embodiment of the present application can improve the success rate of the one-way connection, thereby improving the success rate of parameter configuration or modification.
[0069] Alternatively, see Figure 3 In another exemplary embodiment of the present application, after step 205, the method further includes the following steps 301 to 304:
[0070] Step 301: The first terminal sends a third topic subscription request to the one-way connection server.
[0071] After the second terminal receives the third theme and the fourth theme, it can use the third theme and the fourth theme to establish a one-way connection with the first terminal to configure the first terminal.
[0072] Before configuring the first terminal, the first terminal needs to subscribe to the third topic. After the first terminal subscribes to the third topic, the one-way connection server will forward any received message containing the third topic to the first terminal, including the configuration request sent by the second terminal.
[0073] Step 302: The second terminal generates a configuration request and sends the configuration request to the one-way connection server. The configuration request carries the third topic and configuration content. The configuration request is used to request configuration of parameters of the first terminal.
[0074] Step 303: The one-way connection server receives the configuration request and sends the configuration request to the first terminal that subscribes to the third topic.
[0075] Step 304: The first terminal receives the configuration request and configures the first terminal based on the configuration content.
[0076] Alternatively, see Figure 4 In another exemplary embodiment of the present application, the configuration request also carries the fourth topic. After step 304, the method further includes the following steps 401 to 403:
[0077] Step 401: The second terminal sends a subscription request for subscribing to the fourth topic to the one-way connection server.
[0078] After the second terminal subscribes to the fourth topic, the one-way connection server will forward any received message containing the fourth topic to the second terminal.
[0079] Step 402: When the first terminal is configured successfully, the first terminal generates a configuration success reminder and sends it to the one-way connection server, where the configuration success reminder carries the third theme and the fourth theme.
[0080] Step 403: The one-way connection server sends the configuration success reminder to the second terminal subscribed to the fourth topic, so that the second terminal knows that the first terminal subscribed to the third topic is successfully configured.
[0081] Alternatively, see Figure 3 In another exemplary embodiment of the present application, after step 304, the method further includes the following step 501:
[0082] Step 501: If the configuration is successful, the first terminal disconnects the one-way connection between the second terminal and the first terminal, and releases the third topic and the fourth topic.
[0083] Timely disconnection of the unidirectional connection between the first terminal and the second terminal can enable other terminals that need to establish a unidirectional connection with the first terminal to also perform the unidirectional connection establishment operation in time, thereby ensuring the smoothness of the operation of each terminal and improving the unidirectional connection efficiency.
[0084] Since the third and fourth topics are temporarily used to establish a one-way connection between the first terminal and the second terminal to perform configuration operations, when the configuration is successful, the third and fourth topics are released in time to reduce the space occupied by the first terminal, the second terminal and the one-way connection server.
[0085] Alternatively, see Figure 5 In another exemplary embodiment of the present application, the connection state further includes non-idle, then after step 202, the method further includes the following step 601:
[0086] Step 601: When the connection state is non-idle, the first terminal generates a non-idle state reminder and sends the non-idle state reminder to a one-way connection server, so that the one-way connection server forwards the non-idle state reminder to the second terminal.
[0087] Step 601 allows the second terminal to know the connection status of the first terminal in a timely manner, so that when the first terminal is in a non-idle state, the second terminal can perform other operations as needed, such as continuing to wait until the first terminal is in an idle state and then sending a new unidirectional connection request.
[0088] Alternatively, see Figure 6 In another exemplary embodiment of the present application, after the above step 601, the method further includes the following steps 701-703:
[0089] Step 701: The first terminal obtains a timestamp carried by a third terminal when interacting with the first terminal most recently, where the third terminal is a terminal that is connected to the first terminal at that time.
[0090] The timestamp is the time when the most recent interaction started.
[0091] Step 702: The first terminal monitors the interval between the timestamp and the current time.
[0092] Step 703: When the interval duration is greater than a predetermined duration, the first terminal disconnects the unidirectional connection between the third terminal and the first terminal.
[0093] The predetermined duration may be an empirical value, for example, 5 minutes.
[0094] When the time interval is greater than the predetermined time length, it indicates that the second terminal and the first terminal have not communicated for a long time, and it is considered that the second terminal no longer needs to communicate with the first terminal, so the second terminal can be disconnected.
[0095] Alternatively, see Figure 7 In another exemplary embodiment of the present application, before step 201, the method further includes steps 801 to 803:
[0096] Step 801: The second terminal generates a unidirectional connection request, where the unidirectional connection request carries a first topic subscribed by the first terminal and a second topic subscribed by the second terminal.
[0097] Step 802: The second terminal sends the one-way connection request to a one-way connection server.
[0098] Step 803: The unidirectional connection server forwards the unidirectional connection request to the first terminal subscribed to the first topic, so that the first terminal knows that the second terminal subscribed to the second topic requests to establish a unidirectional connection.
[0099] Before generating new third and fourth topics, the first terminal and the second terminal need to establish a one-way connection based on the known first and second topics. Only after the one-way connection is established can a new topic be generated.
[0100] Alternatively, see Figure 8 In another exemplary embodiment of the present application, another unidirectional connection method is provided, which is applied to a second terminal and includes the following steps 901 to 904:
[0101] Step 901, sending a one-way connection request, wherein the one-way connection request is used to request to establish a one-way connection with a first terminal through a publicly known topic, and enable the first terminal to generate a private topic, and forward the private topic to the second terminal through a one-way connection server, wherein the publicly known topic includes a first topic and a second topic, and the private topic includes a third topic and a fourth topic;
[0102] Step 902, receiving the third topic and the fourth topic forwarded by the one-way connection server;
[0103] Step 903: Send a subscription request for subscribing to the fourth topic to the unidirectional connection server;
[0104] Step 904, generate a configuration request and send the configuration request to the one-way connection server, the configuration request carries the third topic, the fourth topic and configuration content, and the configuration request is used to request the first terminal to subscribe to the fourth topic according to the configuration content.
[0105] In an exemplary embodiment, a terminal device is provided, and the internal structure diagram of the terminal device can be as follows: Fig. 9 As shown. The terminal device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the terminal device is used to provide computing and control capabilities. The memory of the terminal device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the terminal device is used to store unidirectional connection related data. The input / output interface of the terminal device is used to exchange information between the processor and an external device. The communication interface of the terminal device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a unidirectional connection method is implemented.
[0106] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the terminal device to which the scheme of the present application is applied. The specific terminal device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0107] In an exemplary embodiment, a terminal device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps in the embodiments executed by the first terminal in the above-mentioned methods are implemented.
[0108] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps performed by the first terminal in the above-mentioned method embodiments are implemented.
[0109] In an exemplary embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps performed by the first terminal in the above-mentioned method embodiments.
[0110] It should be noted that 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 relevant regulations.
[0111] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0112] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.
[0113] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0114] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A one-way connection method, characterized in that: Applied to the first terminal, comprising: receiving a one-way connection request, the one-way connection request being generated by the second terminal and being used to request to establish a one-way connection with the first terminal through a well-known topic, the well-known topic comprising a first topic and a second topic; In response to the unidirectional connection request, checking a current connection status of the first terminal itself; When the connection state is an idle state, generating a private topic, the private topic including a third topic and a fourth topic, the third topic and the fourth topic are different from the first topic and the second topic, and the idle state is used to indicate that the first terminal is not connected to any terminal; Based on the third topic and the fourth topic, generating a use instruction, the use instruction is used to instruct the second terminal to publish a message using the fourth topic, and the first terminal to reply a message to the second terminal using the third topic; The use instruction is sent to the second terminal, so that the second terminal establishes a one-way connection with the first terminal through the third theme and the fourth theme.
2. The one-way connection method according to claim 1, characterized in that: After sending the use instruction to the second terminal, the method further includes: Sending a third topic subscription request to the one-way connection server; wherein the one-way connection server is used to: receive a configuration request generated by the second terminal, and send the configuration request to the first terminal subscribed to the third topic, the configuration request carries the third topic and configuration content, and the configuration request is used to request configuration parameters of the first terminal; The configuration request is received, and configuration is performed based on the configuration content.
3. The one-way connection method according to claim 2, characterized in that: The configuration request also carries the fourth topic. After receiving the configuration request and performing configuration based on the configuration content, the method further includes: When the first terminal is configured successfully, a configuration success reminder is generated and sent to the one-way connection server; wherein the configuration success reminder carries the third topic and the fourth topic; the one-way connection server is also used to send the configuration success reminder to the second terminal subscribed to the fourth topic, so that the second terminal knows that the first terminal subscribed to the third topic is successfully configured.
4. The one-way connection method according to claim 2, characterized in that: After receiving the configuration request and performing configuration based on the configuration content, the method further includes: If the configuration is successful, the unidirectional connection between the second terminal and the first terminal is disconnected, and the third topic and the fourth topic are released.
5. The one-way connection method according to claim 1, characterized in that: If the connection state further includes non-idle, then after checking the current connection state of the first terminal itself, the method further includes: When the connection state is non-idle, a non-idle state reminder is generated, and the non-idle state reminder is sent to a one-way connection server, so that the one-way connection server forwards the non-idle state reminder to the second terminal.
6. The one-way connection method according to claim 5, characterized in that: After generating a non-idle state reminder and sending the non-idle state reminder to the one-way connection server, the method further includes: Acquire a timestamp carried by a third terminal when interacting with the first terminal most recently, the third terminal being a terminal that is in a connected state with the first terminal at that time; Monitoring the interval between the timestamp and the current time; When the interval duration is greater than a predetermined duration, the unidirectional connection between the third terminal and the first terminal is disconnected.
7. A one-way connection method, characterized in that: Applied to the second terminal, including: Sending a one-way connection request, wherein the one-way connection request is used to request to establish a one-way connection with the first terminal through a publicly known topic, and enable the first terminal to generate a private topic, and forward the private topic to the second terminal through a one-way connection server, wherein the publicly known topic includes a first topic and a second topic, and the private topic includes a third topic and a fourth topic; Receiving the third topic and the fourth topic forwarded by the one-way connection server; Sending a subscription request to the unidirectional connection server to subscribe to the fourth topic; A configuration request is generated and sent to the one-way connection server, wherein the configuration request carries the third topic, the fourth topic and configuration content, and the configuration request is used to request configuration of the first terminal subscribing to the fourth topic according to the configuration content.
8. A terminal device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the unidirectional connection method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the unidirectional connection method described in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the unidirectional connection method described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Message processing method and device and message cluster server
CN112307487A
MQTT theme subscription system and method based on wake-up channel, terminal and medium
CN115378989A
Information synchronization method and device and related equipment
CN115776587A
Message transceiving method and device based on MQTT protocol
CN116846959A
Equipment search method, system and device, computer equipment and storage medium
CN117014850A