CN111866092B - Message transmission method and device, electronic equipment and readable storage medium - Google Patents

Message transmission method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN111866092B
CN111866092B CN202010621784.5A CN202010621784A CN111866092B CN 111866092 B CN111866092 B CN 111866092B CN 202010621784 A CN202010621784 A CN 202010621784A CN 111866092 B CN111866092 B CN 111866092B
Authority
CN
China
Prior art keywords
node
cluster
topic
connection
publishing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010621784.5A
Other languages
Chinese (zh)
Other versions
CN111866092A (en
Inventor
张�浩
朱鸿伟
张扬扬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202010621784.5A priority Critical patent/CN111866092B/en
Publication of CN111866092A publication Critical patent/CN111866092A/en
Application granted granted Critical
Publication of CN111866092B publication Critical patent/CN111866092B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0823Network architectures or network communication protocols for network security for authentication of entities using certificates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0869Network architectures or network communication protocols for network security for authentication of entities for achieving mutual authentication

Abstract

The application discloses a message transmission method and device, electronic equipment and a readable storage medium, and relates to the technical field of cloud computing. The implementation scheme adopted when the message is transmitted is as follows: sending a connection request to a preset node in the cluster, and adding the connection request into the cluster after the authentication is passed; registering a first topic to be subscribed in a cluster; and establishing connection with the publishing node corresponding to the first theme in the cluster, and receiving the message sent by the publishing node. The method and the device can reduce the delay of message transmission, improve the safety of message transmission and the like.

Description

Message transmission method and device, electronic equipment and readable storage medium
Technical Field
The application relates to the technical field of internet of things, in particular to a method and a device for message transmission, electronic equipment and a readable storage medium in the technical field of cloud computing.
Background
In the internet of things environment, the MQTT (Message Queuing Telemetry Transport) protocol is a widely used m2m (machine to machine) protocol.
However, the conventional MQTT communication system is a client-side and server-side based system, which provides communication services for each node or device through a publish/subscribe mode, i.e. messages between nodes need to be forwarded through a server. Therefore, as the number of clients increases dramatically, the server becomes a bottleneck of the system, and when the server encounters a failure or performance degradation, the communication system may fail or performance degradation may be caused.
Disclosure of Invention
The technical solution adopted by the present application to solve the technical problem is to provide a method for transmitting a message, including: sending a connection request to a preset node in the cluster, and adding the connection request into the cluster after passing authentication; registering a first topic to be subscribed in a cluster; and establishing connection with the publishing node corresponding to the first theme in the cluster, and receiving the message sent by the publishing node.
The technical solution adopted by the present application to solve the technical problem is to provide a device for transmitting a message, including: the connection unit is used for sending a connection request to a preset node in the cluster and adding the connection request into the cluster after the authentication is passed; the system comprises a registration unit, a subscription unit and a service unit, wherein the registration unit is used for registering a first topic to be subscribed in a cluster; and the receiving unit is used for establishing connection with the publishing node corresponding to the first theme in the cluster and receiving the message sent by the publishing node.
An electronic device, comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the above method.
A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the above method.
A computer program product comprising a computer program which, when executed by a processor, implements the above method.
One embodiment in the above application has the following advantages or benefits: the method and the device can reduce the delay of message transmission, improve the safety of message transmission and the like. Because the technical means of directly receiving the message sent by the publishing node corresponding to the subscribed first topic in the cluster in a point-to-point communication mode is adopted, the technical problem that the message sent by the node needs to be forwarded by the server in the prior art is solved, and the technical effects of reducing the delay of message transmission, improving the safety of message transmission and the like are achieved.
Other effects of the above alternatives will be described below with reference to specific embodiments.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be considered limiting of the present application. Wherein:
FIG. 1 is a schematic illustration according to a first embodiment of the present application;
FIG. 2 is a schematic illustration according to a second embodiment of the present application;
FIG. 3 is a schematic illustration according to a third embodiment of the present application;
fig. 4 is a block diagram of an electronic device for implementing a method of message transmission according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram according to a first embodiment of the present application. As shown in fig. 1, the method for transmitting a message in this embodiment may specifically include the following steps:
s101, sending a connection request to a preset node in a cluster, and adding the connection request into the cluster after the authentication is passed;
s102, registering a first theme to be subscribed in a cluster;
s103, establishing connection with the publishing node corresponding to the first theme in the cluster, and receiving the message sent by the publishing node.
The main execution body of the message transmission method in this embodiment is a node to be added to a cluster, and after the node is added to the cluster, a message sent by a publishing node corresponding to a first topic subscribed by the node in the cluster is directly received in a point-to-point communication manner, so that the message transmission does not need to be relayed by other nodes or a server, the message transmission delay is reduced, and the message transmission safety is improved.
Because the server does not need to be deployed, the message transmission cost can be reduced, single-point faults and performance limitations of the server can be avoided, and the message transmission stability is improved.
The implementation process of the above embodiment is illustrated: if the node to be added into the cluster is the node A, the cluster to be added into the node A comprises a node B, a node C and a node D; if the node A sends a connection request to the node B in the cluster and passes the authentication, the node A is added into the cluster; after the node A joins the cluster, registering a first topic to be subscribed in the cluster, for example, if the subscribed first topic is topic 1, the cluster stores registration information for the node A to subscribe to the topic 1; if the publishing node corresponding to the topic 1 is the node C, and the node C can determine that the node a subscribes to the published topic according to the registration information in the cluster, the node a can establish connection with the node C, so as to directly receive the message sent by the node C.
The cluster in this embodiment is formed by a plurality of nodes, and each node corresponds to a client of a different user. In addition, different nodes in the cluster have uniqueness, and one node can only join one cluster.
When sending a connection request to a preset node in a cluster, a node to be added to the cluster in this embodiment may send the connection request to any node in the cluster to be added, or may send the connection request to a specific node in the cluster to be added.
In a cluster based on point-to-point communication, if there is no related security authentication, the cluster is easily attacked by a malicious node. In order to avoid the cluster being attacked by the malicious node and improve the security of communication between nodes in the cluster, in this embodiment, when the node to be added to the cluster sends the connection request to the preset node in the cluster in step S101, an optional implementation manner that may be adopted is: and sending a connection request containing certificate information and signature information to a preset node in the cluster, so that other nodes in the cluster carry out authentication according to the certificate information and the signature information provided by the node to be added into the cluster, and allowing the node to be added into the cluster after the authentication is passed, otherwise, returning cluster addition failure information to the node.
In this embodiment, when step S101 is executed to acquire the certificate information of the node to be added to the cluster, the optional implementation manner that may be adopted is as follows: generating a Certificate Request file (CSR) including a public key, the CSR file including information for identifying node identities, such as a node location and a node IP address; requesting a signature from a Certificate Authority (CA) corresponding to the cluster by using the generated Certificate request file, and acquiring a digital Certificate issued by the Certificate Authority, wherein the issued digital Certificate includes information such as an IP address of the node, an ID of the node, and the like, and also includes Authority information of the node, for example, information such as a topic allowed to be issued by the node, and a topic allowed to be subscribed by the node; certificate information is obtained from the issued digital certificate.
In this embodiment, when step S101 is executed to acquire signature information of a node to be added to a cluster, an optional implementation manner that may be adopted is as follows: generating a private key; encrypting the identity information of the node by using a private key to generate a digital signature, wherein the generated digital signature is used for identifying the identity of the node; signature information is acquired from the generated digital signature.
After the node to be joined to the cluster passes the authentication and joins the cluster, the node to be joined to the cluster registers the first topic to be subscribed in the cluster. Since one topic in the cluster can be subscribed by multiple nodes, the cluster of this embodiment may further include, in addition to the nodes, registration information of the subscribed topics of each node, where the registration information is used to indicate which nodes subscribed to each topic are respectively.
Since the node may be limited by the authority in the digital certificate owned by the node when subscribing to the topic, in order to prevent the subscription of a malicious node, when the node to be joined to the cluster performs step S102 to register the first topic to be subscribed in the cluster, an optional implementation manner that may be adopted is: sending certificate information and a first topic to be subscribed to other nodes in the cluster for authentication, namely determining whether the node has the authority of subscribing the first topic or not by the other nodes according to the certificate information; and in response to receiving the authentication passing information sent by other nodes, completing the operation of registering the first subject to be subscribed in the cluster, otherwise, returning the information of registration failure.
In order to further improve the authentication accuracy of the node, in this embodiment, when step S102 is executed to send the certificate information and the first topic to be subscribed to other nodes in the cluster, signature information may also be sent to further ensure the identity of the node performing the topic subscription.
After the node to be added to the cluster in this embodiment completes the registration of subscribing to the first topic, the node establishes a connection with the publishing node corresponding to the first topic, thereby directly receiving the message sent by the publishing node. Different publishing nodes can publish messages corresponding to different topics, and each publishing node can only send messages to nodes subscribing the published topics in the cluster.
In order to further ensure the accuracy of message transmission and prevent the message publishing of a malicious node, when the node to be added to the cluster in this embodiment performs step S103 to establish a connection with the publishing node corresponding to the first topic, an optional implementation manner that may be adopted is: receiving certificate information sent by an issuing node; determining whether the issuing node has the authority of issuing the message of the first theme or not according to the certificate information; if so, receiving a connection request sent by the publishing node, and establishing connection with the publishing node; if not, rejecting the connection request sent by the issuing node.
Because the MQTT (Message Queuing Telemetry Transport) protocol is widely used, the Message format of the MQTT protocol may be used in this embodiment as a format for transmitting messages between nodes, that is, the Message sent by a node may be encapsulated into a standard format of the MQTT protocol for transmission in this embodiment.
After the connection between the node to be added to the cluster and the publishing node is established, the node to be added to the cluster in this embodiment may also perform authentication through a two-way certificate, and may encrypt the message through a symmetric key negotiated between the nodes, which may further prevent the message from being intercepted, thereby ensuring the security of message transmission.
Because the cluster based on the point-to-point communication is a distributed environment, the nodes in the cluster need to be managed to update the relevant information of the nodes which are actively disconnected or abnormally off-line in the cluster, and resource waste caused by storing irrelevant information in the cluster is avoided.
Therefore, after the node to be joined in the cluster in this embodiment performs S101 to join the cluster, the following contents may also be included: communicating with other nodes with a preset number in the cluster according to a preset time length; and updating node information corresponding to the cluster and metadata information corresponding to each node according to the communication result, for example, registration information of subscription topics of disconnected nodes in the cluster, an ID of the node and the like are removed, wherein the node information corresponding to the cluster comprises the nodes contained in the cluster, the registration information of subscription topics of each node and the like, and the metadata information corresponding to each node comprises an IP address of each node, an ID of each node and the like.
It can be understood that, for the network communication service on which the node management service depends, the present embodiment may be configured in different implementations according to different requirements, for example, TCP, UDP, and the like.
That is to say, in this embodiment, the node to be added to the cluster is a subscribing node, and receives the message sent by the publishing node corresponding to the first topic by registering the first topic to be subscribed.
Through the technical scheme provided by the embodiment, when the message is transmitted, the message is not required to be forwarded by the server, but the message sent by the publishing node corresponding to the subscribed first topic in the cluster is directly received by the node in a point-to-point communication mode, so that on one hand, the delay of the message transmission can be reduced, the safety of the message transmission can be improved, on the other hand, the cost of the message transmission can be reduced, and the stability of the message transmission can be improved.
Fig. 2 is a schematic diagram according to a second embodiment of the present application. As shown in fig. 2, after a node to be added to a cluster joins the cluster, the method for message transmission according to this embodiment may further include the following steps:
s201, registering a second theme to be issued in the cluster;
s202, determining a subscription node which subscribes the second theme in the cluster;
S203, establishing connection with the subscription node, and sending the message to the subscription node.
That is to say, in this embodiment, the node to be added to the cluster is a publishing node, and after registering the second topic to be published, the publishing node directly sends a message to a subscribing node that subscribes to the second topic in the cluster. It will be appreciated that for nodes in the cluster, the topic subscribed to is a first topic and the topic published is a second topic.
In this embodiment, after the node joins the cluster, the message is directly sent to the subscribing node subscribing the second topic published by the node in the cluster in a point-to-point communication manner, so that the message transmission does not need to be relayed by other nodes or a server, the message transmission delay is reduced, and the message transmission security is improved.
Because the server does not need to be deployed, the message transmission cost can be reduced, the problems of single-point failure and performance limitation of the server are avoided, and the message transmission stability is improved.
In order to prevent the message publishing of the malicious node, when the node to be joined to the cluster performs S201 to register the second topic to be published in the cluster, an optional implementation manner that may be adopted is as follows: sending certificate information and a second theme to be issued to other nodes in the cluster for authentication, namely, the other nodes can determine whether the nodes have the authority of issuing the second theme according to the certificate information; and after receiving the authentication passing information sent by other nodes, finishing registering the second theme to be issued in the cluster, otherwise, returning the information of registration failure.
In order to further improve the authentication accuracy of the node, in this embodiment, when S201 is executed to send the certificate information and the second topic to be issued to other nodes in the cluster, signature information may also be sent to further ensure the identity of the node that issues the topic.
Since the cluster may store the registration information of the different node subscription topics, after the node to be added to the cluster in this embodiment completes the registration of the second topic to be published, it can determine which nodes subscribe to the topic to be published according to the registration information in the cluster by executing S202, and thus the determined nodes are used as the subscription nodes, and the published message is directly sent to each subscription node.
Correspondingly, before the node to join the cluster in this embodiment performs S203 to establish a connection with the subscribing node, the following may also be included: sending certificate information to the subscription node for authority authentication of the subscription node, namely determining whether the publishing node has the authority to publish the message of the second topic by the subscription node; and sending a connection request to the subscription node, so as to establish connection with the subscription node after the subscription node passes the certificate information authentication.
It may be understood that, if the node to be added to the cluster in this embodiment determines that there is no subscribing node subscribing to the second topic in the cluster, and the node cannot complete sending the message, the node returns the message publishing failure information. The embodiment may also return the information of the message publishing failure to the node after trying for several times and still determining that there is no subscribing node in the cluster for the second topic.
Fig. 3 is a schematic diagram according to a third embodiment of the present application. As shown in fig. 3, the message transmission apparatus of this embodiment is located at a node to be joined to a cluster, and includes:
the connection unit 301 is configured to send a connection request to a preset node in the cluster, and join the cluster after the authentication is passed;
a registering unit 302, configured to register a first topic to be subscribed in a cluster;
the receiving unit 303 is configured to establish a connection with a publishing node in the cluster corresponding to the first topic, and receive a message sent by the publishing node.
When sending a connection request to a preset node in a cluster, the connection unit 301 may send the connection request to any node in the cluster to be joined, or may send the connection request to a designated node in the cluster to be joined.
In a cluster based on point-to-point communication, if there is no related security authentication, the cluster is easily attacked by a malicious node. In order to avoid the cluster from being attacked by the malicious node and improve the security of communication between nodes in the cluster, when the connection unit 301 sends a connection request to a preset node in the cluster, the optional implementation manner that may be adopted is: and sending a connection request containing certificate information and signature information to a preset node in the cluster, so that other nodes in the cluster carry out authentication according to the certificate information and the signature information provided by the node to be added into the cluster, and allowing the node to be added into the cluster after the authentication is passed, otherwise, returning cluster addition failure information to the node.
When acquiring the certificate information of the node to be added to the cluster, the connection unit 301 may adopt an optional implementation manner as follows: generating a certificate request file containing a public key; requesting a signature to a certificate authority corresponding to the cluster by using the generated certificate request file to acquire a digital certificate issued by the certificate authority; certificate information is obtained from the issued digital certificate.
When the connection unit 301 obtains the signature information of the node to be added to the cluster, the optional implementation manner that may be adopted is: generating a private key; encrypting the identity information of the node by using a private key to generate a digital signature; signature information is acquired from the generated digital signature.
After the node to join the cluster through the connection unit 301, the registration unit 302 registers the first topic to be subscribed in the cluster.
Since a node may be limited by the authority in the digital certificate owned by the node when subscribing to a topic, in order to prevent subscription of a malicious node, when the registration unit 302 registers a first topic to be subscribed in the cluster, an optional implementation manner that may be adopted is: sending certificate information and a first topic to be subscribed to other nodes in the cluster for authentication, namely determining whether the node has the authority of subscribing the first topic or not by the other nodes according to the certificate information; and in response to receiving the authentication passing information sent by other nodes, completing the operation of registering the first subject to be subscribed in the cluster, otherwise, returning the information of registration failure.
In order to further improve the authentication accuracy of the node, when sending the certificate information and the first topic to be subscribed to other nodes in the cluster, the registration unit 302 may also send signature information to further ensure the identity of the node performing the topic subscription.
After the registration unit 302 completes the registration of subscribing the first topic, the node to be added to the cluster establishes a connection with the publishing node corresponding to the first topic through the receiving unit 303, thereby directly receiving the message sent by the publishing node. Different publishing nodes can publish messages corresponding to different topics, and each publishing node can only send messages to nodes subscribing the published topics in the cluster.
In order to further ensure the accuracy of message transmission and prevent the message publishing of the malicious node, when the receiving unit 303 establishes a connection with the publishing node corresponding to the first topic, the optional implementation manner that may be adopted is: receiving certificate information sent by an issuing node, and determining whether the issuing node has the authority of issuing the message of the first theme; if so, receiving a connection request sent by the publishing node, and establishing connection with the publishing node; if not, rejecting the connection request sent by the issuing node.
After the node to be added to the cluster establishes a connection with the publishing node through the receiving unit 303, the node may also perform authentication through a two-way certificate, and may encrypt the message through a symmetric key negotiated between the nodes, which may further prevent the message from being intercepted, thereby ensuring the security of message transmission.
Therefore, after the node to be added to the cluster in this embodiment joins the cluster, the connection unit 301 may further include the following contents: communicating with other nodes with a preset number in the cluster according to a preset time length; and updating node information corresponding to the cluster and metadata information corresponding to each node according to the communication result.
It is understood that the connection unit 301 may be configured to implement different network communication services depending on different requirements.
The apparatus for message transmission in this embodiment may further include an issuing unit 304, configured to specifically execute, after a node to be added to the cluster joins the cluster, the following steps: registering a second topic to be published in the cluster; determining a subscription node subscribing to a second topic in the cluster; and establishing connection with the subscription node and sending the message to the subscription node.
In order to prevent the message publishing of the malicious node, when the publishing unit 304 registers the second topic to be published in the cluster, the following optional implementation manners may be adopted: sending certificate information and a second theme to be issued to other nodes in the cluster for authentication, namely, the other nodes can determine whether the nodes have the authority of issuing the second theme according to the certificate information; and after receiving the authentication passing information sent by other nodes, finishing registering the second theme to be issued in the cluster, otherwise, returning the information of registration failure.
In order to further improve the authentication accuracy of the node, the issuing unit 304 may further send signature information when sending the certificate information and the second topic to be issued to other nodes in the cluster, so as to further ensure the identity of the node performing topic issuing.
Since the cluster may store the registration information of the subscribed topics of different nodes, after the registration of the second topic to be published is completed, the publishing unit 304 can determine which nodes to subscribe to the published topic through the registration information in the cluster, and thus, the determined nodes are used as the subscribing nodes and directly send the published message to each subscribing node.
Accordingly, the publishing unit 304, before performing the operation of establishing the connection with the subscribing node, may further include the following: sending certificate information to the subscription node for authority authentication of the subscription node, namely determining whether the publishing node has the authority to publish the message of the second topic by the subscription node; and sending a connection request to the subscription node, so as to establish connection with the subscription node after the subscription node passes the certificate information authentication.
It is understood that if the publishing unit 304 determines that there is no subscribing node subscribing to the second topic in the cluster, and the node cannot complete sending the message, then a message publishing failure is returned. The publishing unit 304 may also return the message publishing failure information to the subscribing node after trying for a number of times to still determine that the subscribing node in the cluster is not subscribed to the second topic.
According to embodiments of the present application, an electronic device, a computer-readable storage medium, and a computer program product are also provided.
Fig. 4 is a block diagram of an electronic device according to the message transmission method in the embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 4, the electronic apparatus includes: one or more processors 401, memory 402, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, if desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). In fig. 4, one processor 401 is taken as an example.
Memory 402 is a non-transitory computer readable storage medium as provided herein. Wherein the memory stores instructions executable by at least one processor to cause the at least one processor to perform the method of message transmission provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the method of message transmission provided herein.
The memory 402, which is a non-transitory computer-readable storage medium, may be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as program instructions/modules corresponding to the method of message transmission in the embodiment of the present application (for example, the connection unit 301, the registration unit 302, the reception unit 303, and the issue unit 304 shown in fig. 3). The processor 401 executes various functional applications of the server and data processing, i.e., implements the method of message transmission in the above-described method embodiments, by running non-transitory software programs, instructions, and modules stored in the memory 402.
The memory 402 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the electronic device, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 402 may optionally include memory located remotely from the processor 401, and these remote memories may be connected over a network to the electronic device of the method of message transmission. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the method for message transmission may further include: an input device 403 and an output device 404. The processor 401, memory 402, input device 403, and output device 404 may be connected by a bus or other means, as exemplified by the bus connection in fig. 4.
The input device 403 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device of the method of message transmission, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, or the like. The output devices 404 may include a display device, auxiliary lighting devices (e.g., LEDs), and tactile feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
According to the technical scheme of the embodiment of the application, when the message is transmitted, the message is not required to be forwarded by the server side, but the message sent by the publishing node corresponding to the subscribed first topic in the cluster is directly received by the node in a point-to-point communication mode, so that on one hand, the delay of the message transmission can be reduced, the safety of the message transmission can be improved, on the other hand, the cost of the message transmission can be reduced, and the stability of the message transmission can be improved.
It should be understood that various forms of the flows shown above, reordering, adding or deleting steps, may be used. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present application can be achieved, and the present invention is not limited herein.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (14)

1. A message transmission method is applied to an MQTT communication system and comprises the following steps:
the method comprises the steps that a node to be added into a cluster sends a connection request to a preset node in the cluster, and the node is added into the cluster after passing authentication, wherein the preset node is any node in the cluster or a designated node in the cluster;
registering a first topic to be subscribed in a cluster;
establishing connection with a publishing node corresponding to the first theme in the cluster, and receiving a message sent by the publishing node;
The registering a first topic to be subscribed in the cluster comprises:
sending certificate information and a first topic to be subscribed to other nodes in the cluster;
and in response to receiving the authentication passing information sent by other nodes, completing the operation of registering the first topic to be subscribed in the cluster.
2. The method of claim 1, wherein the sending a connection request to a preset node in a cluster comprises: and sending a connection request containing certificate information and signature information to a preset node in the cluster.
3. The method of claim 1, wherein the establishing a connection with a publishing node in a cluster corresponding to the first topic comprises:
receiving certificate information sent by the issuing node;
determining whether the publishing node has the authority to publish the message of the first topic according to the certificate information;
if so, receiving a connection request sent by the publishing node, and establishing connection with the publishing node; if not, rejecting the connection request sent by the issuing node.
4. The method of claim 1, further comprising,
after the second theme is added into the cluster after the authentication is passed, registering the second theme to be issued in the cluster;
Determining a subscription node subscribing to the second topic in the cluster;
and establishing connection with the subscription node, and sending the message to the subscription node.
5. The method of claim 4, wherein the registering in the cluster the second topic for publication comprises:
sending certificate information and a second subject to be issued to other nodes in the cluster;
and in response to receiving the authentication passing information sent by other nodes, finishing the operation of registering the second theme to be published in the cluster.
6. The method of claim 4, wherein the establishing a connection with the subscribing node comprises:
sending certificate information to the subscribing node;
sending a connection request to the subscribing node for establishing a connection with the subscribing node.
7. A message transmission device applied to an MQTT communication system is positioned at a node to be joined into a cluster and comprises the following components:
the connection unit is used for sending a connection request to a preset node in the cluster and adding the connection request into the cluster after the authentication is passed, wherein the preset node is any node in the cluster or a designated node in the cluster;
the system comprises a registration unit, a subscription unit and a service unit, wherein the registration unit is used for registering a first topic to be subscribed in a cluster;
The receiving unit is used for establishing connection with a publishing node corresponding to the first theme in the cluster and receiving a message sent by the publishing node;
when the registering unit registers the first topic to be subscribed in the cluster, the registering unit specifically executes:
sending certificate information and a first topic to be subscribed to other nodes in the cluster;
and in response to receiving the authentication passing information sent by other nodes, completing the operation of registering the first topic to be subscribed in the cluster.
8. The apparatus according to claim 7, wherein the connection unit, when sending the connection request to a preset node in the cluster, specifically performs: and sending a connection request containing certificate information and signature information to a preset node in the cluster.
9. The apparatus according to claim 7, wherein the receiving unit, when establishing a connection with a publishing node in the cluster corresponding to the first topic, specifically performs:
receiving certificate information sent by the issuing node;
determining whether the publishing node has the authority to publish the message of the first topic according to the certificate information;
if so, receiving a connection request sent by the publishing node, and establishing connection with the publishing node; if not, rejecting the connection request sent by the issuing node.
10. The apparatus of claim 7, further comprising an issuing unit,
the system is used for registering a second theme to be issued in the cluster after the second theme is added to the cluster after the authentication is passed;
determining a subscription node subscribing to the second topic in the cluster;
and establishing connection with the subscription node, and sending the message to the subscription node.
11. The apparatus according to claim 10, wherein the publishing unit, when registering the second topic to be published in the cluster, specifically performs:
sending certificate information and a second subject to be issued to other nodes in the cluster;
and in response to receiving the authentication passing information sent by other nodes, finishing the operation of registering the second theme to be published in the cluster.
12. The apparatus according to claim 10, wherein the publishing unit, when establishing a connection with the subscribing node, specifically performs:
sending certificate information to the subscribing node;
sending a connection request to the subscribing node for establishing a connection with the subscribing node.
13. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
14. A non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method of any one of claims 1-6.
CN202010621784.5A 2020-06-30 2020-06-30 Message transmission method and device, electronic equipment and readable storage medium Active CN111866092B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010621784.5A CN111866092B (en) 2020-06-30 2020-06-30 Message transmission method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010621784.5A CN111866092B (en) 2020-06-30 2020-06-30 Message transmission method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN111866092A CN111866092A (en) 2020-10-30
CN111866092B true CN111866092B (en) 2022-06-28

Family

ID=72989858

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010621784.5A Active CN111866092B (en) 2020-06-30 2020-06-30 Message transmission method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN111866092B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527530B (en) * 2020-12-21 2024-02-23 北京百度网讯科技有限公司 Message processing method, device, apparatus, storage medium and computer program product
CN113348454A (en) * 2021-06-25 2021-09-03 商汤国际私人有限公司 Cluster management method and device, electronic equipment and storage medium
CN116016489A (en) * 2022-12-16 2023-04-25 中电金信软件有限公司 File transmission method and device, electronic equipment and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2222057A1 (en) * 2009-02-24 2010-08-25 Research In Motion Limited Subscription management for a content-based presence service
CN106953901A (en) * 2017-03-10 2017-07-14 重庆邮电大学 A kind of trunked communication system and its method for improving message transmission performance
CN107026917A (en) * 2017-06-16 2017-08-08 智者四海(北京)技术有限公司 The method and system pushed for message
CN108927808A (en) * 2018-08-15 2018-12-04 京东方科技集团股份有限公司 A kind of communication means, authentication method and the device of ROS node
WO2019036118A1 (en) * 2017-08-15 2019-02-21 Microsoft Technology Licensing, Llc Managing subscriptions for event notifications
CN110034927A (en) * 2019-03-25 2019-07-19 阿里巴巴集团控股有限公司 A kind of method and device of communication
CN110912808A (en) * 2019-11-29 2020-03-24 三一重工股份有限公司 Message subscription method, device, system, equipment terminal and readable storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100322236A1 (en) * 2009-06-18 2010-12-23 Nokia Corporation Method and apparatus for message routing between clusters using proxy channels
CN106657130B (en) * 2017-01-09 2020-05-19 上海浦东软件园汇智软件发展有限公司 MQTT-based access authentication method and equipment
CN110336736B (en) * 2019-05-27 2021-04-06 四川长虹电器股份有限公司 Method for realizing shared subscription based on MQTT server cluster

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2222057A1 (en) * 2009-02-24 2010-08-25 Research In Motion Limited Subscription management for a content-based presence service
CN106953901A (en) * 2017-03-10 2017-07-14 重庆邮电大学 A kind of trunked communication system and its method for improving message transmission performance
CN107026917A (en) * 2017-06-16 2017-08-08 智者四海(北京)技术有限公司 The method and system pushed for message
WO2019036118A1 (en) * 2017-08-15 2019-02-21 Microsoft Technology Licensing, Llc Managing subscriptions for event notifications
CN108927808A (en) * 2018-08-15 2018-12-04 京东方科技集团股份有限公司 A kind of communication means, authentication method and the device of ROS node
CN110034927A (en) * 2019-03-25 2019-07-19 阿里巴巴集团控股有限公司 A kind of method and device of communication
CN110912808A (en) * 2019-11-29 2020-03-24 三一重工股份有限公司 Message subscription method, device, system, equipment terminal and readable storage medium

Also Published As

Publication number Publication date
CN111866092A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
CN111327720B (en) Network address conversion method, device, gateway equipment and storage medium
CN111866092B (en) Message transmission method and device, electronic equipment and readable storage medium
CN111741026B (en) Cross-chain transaction request processing method, device, equipment and storage medium
CN113141386B (en) Kubernetes cluster access method, device, equipment and medium in private network
CN110865855B (en) Applet processing method and related equipment
US11750396B2 (en) Private data processing method, device and medium
CN109729040B (en) Method, apparatus and computer readable medium for selection of a protocol
CN111934840A (en) Communication method of client and server, gateway, electronic equipment and storage medium
US9432449B2 (en) Managing connection failover in a load balancer
CN112583867B (en) Sharing method and device of intelligent household electrical appliance, electronic equipment and medium
CN112437006B (en) Request control method and device based on API gateway, electronic equipment and storage medium
CN112671778B (en) Account management method, device, equipment and storage medium for electronic equipment
CN111274591A (en) Method, device, electronic equipment and medium for accessing Kubernetes cluster
CN111858628A (en) Database-based management method, database-based management platform, electronic device and storage medium
CN111552934A (en) Database access method and device
CN111787088B (en) Method and device for processing small program data
CN111698346A (en) Private network address conversion method and device, private network gateway and storage medium
CN112000880B (en) Push message processing method and device, electronic equipment and readable storage medium
CN113132304B (en) Rights and interests service processing method and device, electronic equipment and storage medium
CN105933270B (en) A kind of processing method and processing device of cloud encryption equipment
CN111770211B (en) SNAT method, SNAT device, electronic equipment and storage medium
CN111770176B (en) Traffic scheduling method and device
US11381665B2 (en) Tracking client sessions in publish and subscribe systems using a shared repository
CN112333030A (en) Method, device, electronic equipment and storage medium for communication between private networks
CN110545320A (en) Intranet data interaction method and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant