CN111866092A - 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
CN111866092A
CN111866092A CN202010621784.5A CN202010621784A CN111866092A CN 111866092 A CN111866092 A CN 111866092A CN 202010621784 A CN202010621784 A CN 202010621784A CN 111866092 A CN111866092 A CN 111866092A
Authority
CN
China
Prior art keywords
node
cluster
topic
connection
sending
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.)
Granted
Application number
CN202010621784.5A
Other languages
Chinese (zh)
Other versions
CN111866092B (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.
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 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 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 registering unit, a subscribing unit and a subscribing unit, wherein the registering unit is used for registering a first theme to be subscribed in a cluster; and the receiving unit is used for establishing connection with the publishing node corresponding to the first subject 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 the computer to perform 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-described alternative 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 intended to limit the present application. Wherein:
FIG. 1 is a schematic diagram according to a first embodiment of the present application;
FIG. 2 is a schematic diagram 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.
In this embodiment, when sending a connection request to a preset node in a cluster, a node to be added to the cluster may send a connection request to any node in the cluster to be added, or may send a connection request to a designated 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, when the node to be added to the cluster in this embodiment executes step S101 to send a connection request to the preset node in the cluster, 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 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 may be subscribed by a plurality of 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 theme to be subscribed to other nodes in the cluster for authentication, namely determining whether the node has the authority of subscribing the first theme 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 theme 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 the subscription 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 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, the connection request sent by the issuing node is rejected.
Because the MQTT (Message Queuing Telemetry Transport) protocol is widely used, the present embodiment may use a Message format of the MQTT protocol as a format for transmitting messages between nodes, that is, the present embodiment may encapsulate messages sent by nodes into a standard format of the MQTT protocol for transmission.
After the node to be added to the cluster in this embodiment establishes connection with the publishing node, authentication may be performed through a two-way certificate, and a message may be encrypted through a symmetric key negotiated between nodes, which may further avoid the message being intercepted, thereby ensuring 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 added to the cluster in this embodiment performs S101 to join the cluster, the following 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, removing registration information of the subscription subject of the disconnected node in the cluster, the ID of the node, and the like, wherein the node information corresponding to the cluster comprises the nodes contained in the cluster, the registration information of the subscription subject of each node, and the like, and the metadata information corresponding to each node comprises the IP address of each node, the ID of each node, and the like.
It is understood that the present embodiment may be configured to different implementations, such as TCP, UDP, etc., according to different requirements for the network communication service on which the node management service depends.
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 message transmission is carried out, the message forwarding is not required to be carried out by the server side, but the message sent by the publishing node corresponding to the first topic subscribed by the node 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 is improved, on the other hand, the cost of the message transmission can be reduced, and the stability of the message transmission is 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 transmitting a message 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 the step S201 is executed to send the certificate information and the second topic to be issued to other nodes in the cluster, the signature information may also be sent to further ensure the identity of the node performing topic issue.
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 be determined which nodes subscribe to the topic to be published according to the registration information in the cluster by executing S202, so that the determined nodes are used as subscription nodes, and the published message is directly sent to each subscription node.
Accordingly, before the node to be joined into the cluster establishes a connection with the subscription node in S203, the following may be further included: sending certificate information to the subscribing node for authority authentication of the subscribing node, namely determining whether the publishing node has the authority to publish the message of the second topic by the subscribing node; and sending a connection request to the subscription node for establishing connection with the subscription node after the subscription node passes the certificate information authentication.
It can 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 message publishing failure information is returned. The embodiment may also return the information of the message publishing failure to the node after trying for a plurality of times and still determining that there is no subscribing node subscribing to the second topic in the cluster.
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 be joined to the cluster joins the cluster through the connection unit 301, the registration unit 302 registers the first topic to be subscribed in the cluster.
Since the nodes may be restricted by the rights in the digital certificate owned by the nodes when subscribing to the topic, in order to prevent the subscription of a malicious node, when the registration unit 302 registers the first topic to be subscribed in the cluster, the optional implementation manner that may be adopted is: sending certificate information and a first theme to be subscribed to other nodes in the cluster for authentication, namely determining whether the node has the authority of subscribing the first theme 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 theme to be subscribed in the cluster, otherwise, returning the information of registration failure.
In order to further improve the authentication accuracy of the node, the registration unit 302 may further send signature information when sending the certificate information and the first topic to be subscribed to other nodes in the cluster, so as to further ensure the identity of the node performing the topic subscription.
After the node to be added to the cluster completes the registration of the subscription first topic through the registration unit 302, the node establishes a connection with the publishing node corresponding to the first topic through the receiving unit 303, so as to directly receive 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 from being published by a malicious node, when the receiving unit 303 establishes a connection with a 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 right to issue 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, the connection request sent by the issuing node is rejected.
After the node to be added to the cluster establishes 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 avoid the message 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: 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, after a node to be added to the cluster joins the cluster, specifically execute: 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 a connection with the subscribing node, may further include the following: sending certificate information to the subscribing node for authority authentication of the subscribing node, namely determining whether the publishing node has the authority to publish the message of the second topic by the subscribing node; and sending a connection request to the subscription node for establishing 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 information of the message publishing failure to the subscribing node after trying for a number of times to determine that the subscribing node in the cluster is not subscribed to the second topic.
According to an embodiment of the present application, an electronic device and a computer-readable storage medium are also provided.
Fig. 4 is a block diagram of an electronic device according to an 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, as 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 message transmission method may further include: an input device 403 and an output device 404. The processor 401, the memory 402, the input device 403 and the output device 404 may be connected by a bus or other means, and fig. 4 illustrates an example of a connection by a bus.
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 other input devices. The output devices 404 may include a display device, auxiliary lighting devices (e.g., LEDs), and haptic 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 may be used, with steps reordered, added, or deleted. 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 (16)

1. A method of message transmission, comprising:
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.
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 registering in the cluster the first topic to subscribe to 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.
4. 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.
5. 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 in the cluster that subscribes to the second topic;
and establishing connection with the subscription node and sending the message to the subscription node.
6. The method of claim 5, wherein said registering in the cluster the second topic to be published 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 issued in the cluster.
7. The method of claim 5, 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.
8. An apparatus for message transmission, comprising:
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 registering unit, a subscribing unit and a subscribing unit, wherein the registering unit is used for registering a first theme to be subscribed in a cluster;
and the receiving unit is used for establishing connection with the publishing node corresponding to the first subject in the cluster and receiving the message sent by the publishing node.
9. The apparatus according to claim 8, 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.
10. The apparatus according to claim 8, wherein the registering unit, when registering the first topic to be subscribed in the cluster, specifically performs:
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.
11. The apparatus according to claim 8, 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.
12. The apparatus of claim 8, 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 into the cluster after the authentication is passed;
determining a subscription node in the cluster that subscribes to the second topic;
And establishing connection with the subscription node and sending the message to the subscription node.
13. The apparatus according to claim 12, 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 issued in the cluster.
14. The apparatus according to claim 12, 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.
15. 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-7.
16. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-7.
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 true CN111866092A (en) 2020-10-30
CN111866092B 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)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527530A (en) * 2020-12-21 2021-03-19 北京百度网讯科技有限公司 Message processing method, device, equipment, 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 (10)

* 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
US20100322236A1 (en) * 2009-06-18 2010-12-23 Nokia Corporation Method and apparatus for message routing between clusters using proxy channels
CN106657130A (en) * 2017-01-09 2017-05-10 上海浦东软件园汇智软件发展有限公司 Access authentication method and access authentication equipment based on MQTT
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
CN110336736A (en) * 2019-05-27 2019-10-15 四川长虹电器股份有限公司 The shared method subscribed to is realized based on MQTT server cluster
CN110912808A (en) * 2019-11-29 2020-03-24 三一重工股份有限公司 Message subscription method, device, system, equipment terminal and readable storage medium

Patent Citations (10)

* 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
US20100322236A1 (en) * 2009-06-18 2010-12-23 Nokia Corporation Method and apparatus for message routing between clusters using proxy channels
CN106657130A (en) * 2017-01-09 2017-05-10 上海浦东软件园汇智软件发展有限公司 Access authentication method and access authentication equipment based on MQTT
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
CN110336736A (en) * 2019-05-27 2019-10-15 四川长虹电器股份有限公司 The shared method subscribed to is realized based on MQTT server cluster
CN110912808A (en) * 2019-11-29 2020-03-24 三一重工股份有限公司 Message subscription method, device, system, equipment terminal and readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
PONGNAPAT JUTADHAMAKORN等: "A scalable and low-cost MQTT broker clustering system", 《2017 2ND INTERNATIONAL CONFERENCE ON INFORMATION TECHNOLOGY(INCIT)》, 15 January 2018 (2018-01-15) *
孔智: "基于MQTT的消息推送集群系统的设计与实现", 《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》, 15 February 2020 (2020-02-15) *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527530A (en) * 2020-12-21 2021-03-19 北京百度网讯科技有限公司 Message processing method, device, equipment, storage medium and computer program product
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

Also Published As

Publication number Publication date
CN111866092B (en) 2022-06-28

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
US20200067903A1 (en) Integration of Publish-Subscribe Messaging with Authentication Tokens
US11750396B2 (en) Private data processing method, device and medium
CN109729040B (en) Method, apparatus and computer readable medium for selection of a protocol
US9432449B2 (en) Managing connection failover in a load balancer
CN111131317B (en) Data processing method, device, equipment and medium based on block chain
MX2014012325A (en) Enabling web clients to provide web services.
US10171630B2 (en) Executing remote commands
CN111274591A (en) Method, device, electronic equipment and medium for accessing Kubernetes cluster
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
CN111858628A (en) Database-based management method, database-based management platform, electronic device and storage medium
CN111552934A (en) Database access method and device
CN111698346A (en) Private network address conversion method and device, private network gateway and storage medium
CN113132304B (en) Rights and interests service processing method and device, electronic equipment and storage medium
CN112000880B (en) Push message processing method and device, electronic equipment and readable storage medium
CN112333030B (en) Method, device, electronic equipment and storage medium for communication between private networks
CN111770211B (en) SNAT method, SNAT device, electronic equipment and storage medium
CN110968856B (en) Login method, login device, electronic equipment and storage medium
US11381665B2 (en) Tracking client sessions in publish and subscribe systems using a shared repository
CN110545320A (en) Intranet data interaction method and equipment
US9456046B2 (en) Dynamic generation of proxy connections
EP2044526A1 (en) System and method for managing domain-state information

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