CN108173739A - A kind of cloud service message treatment method based on MQTT - Google Patents

A kind of cloud service message treatment method based on MQTT Download PDF

Info

Publication number
CN108173739A
CN108173739A CN201711230983.8A CN201711230983A CN108173739A CN 108173739 A CN108173739 A CN 108173739A CN 201711230983 A CN201711230983 A CN 201711230983A CN 108173739 A CN108173739 A CN 108173739A
Authority
CN
China
Prior art keywords
message
message server
client
request
theme
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.)
Pending
Application number
CN201711230983.8A
Other languages
Chinese (zh)
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.)
CHENGDU DONGFANGSHENGXING ELECTRONICS Co Ltd
Original Assignee
CHENGDU DONGFANGSHENGXING ELECTRONICS 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 CHENGDU DONGFANGSHENGXING ELECTRONICS Co Ltd filed Critical CHENGDU DONGFANGSHENGXING ELECTRONICS Co Ltd
Priority to CN201711230983.8A priority Critical patent/CN108173739A/en
Publication of CN108173739A publication Critical patent/CN108173739A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/06Message adaptation to terminal or network requirements
    • H04L51/066Format adaptation, e.g. format conversion or compression
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/07User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail characterised by the inclusion of specific contents
    • H04L51/18Commands or executable codes
    • 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
    • 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
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a kind of cloud service message treatment methods based on MQTT, include the following steps:Client sends access authentication and asks to message server end, message server feedback access authentication result confirms connection, client sends to message server and subscribes to theme certification request, message server feedback subscribes to theme certification request result to institute's client, the client certification request that will give out information is sent to message server, message server feeds back the authentication result that gives out information, client determines to connect with message server, message server receive client to message server sends unsubscribe theme request and unsubscribe theme request results to client feedback, client disconnects request to message server transmission, message server performs related preservation and cleaning operation.

Description

A kind of cloud service message treatment method based on MQTT
Technical field
The present invention relates to field of Internet communication more particularly to a kind of cloud service message treatment methods based on MQTT.
Background technology
Current mechanics of communication, in newly-increased a piece of news, majority is to establish a long connection by client Socket monitors the message that server-side issues, and this long connection easily causes clogged with messages, constantly sending heartbeat can consume Flow, and connect quantity and be restricted.
MQTT communications protocol is limited for a large amount of computing capabilitys, and be operated in low broadband, insecure network long-range biography The agreement of sensor or communication control design, it has the property that:
1) using publish/subscribe massage pattern, one-to-many news release is provided, releases application program coupling;
2) message of load contents shielding is transmitted;
3) network connection is provided using TCP/IP;
4) there are three types of news release service quality:
" at most primary ", news release is completely dependent on bottom TCP/IP networks.Information drop-out or repetition can occur.This rank can For following situation, environmental sensor data, losing a read record, it doesn't matter, because also having second of transmission shortly after.
" at least once ", it is ensured that message reaches, but message repeats to occur.
" only once ", it is ensured that message reaches primary.This rank can be used for following situation, in charge system, message It repeats or loses that incorrect result can be caused.
Small-sized transmission, expense very little (head of regular length is 2 bytes), agreement, which exchanges, to be minimized, to reduce network flow Amount;
According to the characteristic of MQTT, it is a kind of highly desirable method to carry out cloud service Message Processing using MQTT.
Invention content
To solve the above-mentioned problems, the present invention proposes a kind of cloud service message treatment method based on MQTT.
Specifically, a kind of cloud service message treatment method based on MQTT, includes the following steps:
S1. client sends access authentication and asks to message server end;
S2. the message server feedback access authentication result confirms connection;
S3. the client sends to the message server and subscribes to theme certification request;
S4. the message server feedback subscribes to theme certification request result to the client;
S5. the client certification request that will give out information is sent to the message server;
S6. the message server feeds back the authentication result that gives out information, and the client determines to connect with the message server;
S7. the message server receive the client to the message server sends unsubscribe theme ask and to The client feedback unsubscribes theme request results;
S8. the client disconnects request to message server transmission, and the message server performs related preserve And cleaning operation.
Further, the access such as authentication request message of the step S1 includes:Fixing head, variable header and message Body, message body include client id, user name and password.
Further, the step S2 is further included:The certification message of message server feedback include fixing head and Variable header, variable header include response results.
Further, the step S3 is further included:Subscribe to theme authentication request message include fixing head, variable header and Message body, message body include the subject subscribed to.
Further, the step S5 is further included:The authentication request message that gives out information include fixing head, variable header and Message body, variable header include subject and message identifier.
Further, the step S5 is further included:It gives out information and all correspondences are sent to by the message server order Reader's client.
Further, the step S7 is further included:Unsubscribe theme request message include fixing head, variable header and Message body, message body include the subject quit the subscription of.
Further, the step S8 is further included:It disconnects request message and only includes fixing head, the messenger service Device performs relevant operation according to the value for disconnecting request message fixing head.
The beneficial effects of the present invention are:With very small communication overhead(Minimum message size is 2 bytes); Support various popular programming languages(Including C, Java, Ruby, Python etc.)And wieldy client;Support publication / pre-determined model simplifies the exploitation of application program;Three kinds of different messages grade of deliveries are provided, allow message that can reach purpose on demand Ground adapts to the network transmission demand in unstable operation.
Description of the drawings
Fig. 1 is a kind of cloud service message treatment method flow diagram based on MQTT of the present invention.
Specific embodiment
For a clearer understanding of the technical characteristics, objects and effects of the present invention, now control illustrates this hair Bright specific embodiment.
As shown in Figure 1, a kind of cloud service message treatment method based on MQTT, includes the following steps:
S1. client sends access authentication and asks to message server end;
S2. the message server feedback access authentication result confirms connection;
S3. the client sends to the message server and subscribes to theme certification request;
S4. the message server feedback subscribes to theme certification request result to the client;
S5. the client certification request that will give out information is sent to the message server;
S6. the message server feeds back the authentication result that gives out information, and the client determines to connect with the message server;
S7. the message server receive the client to the message server sends unsubscribe theme ask and to The client feedback unsubscribes theme request results;
S8. the client disconnects request to message server transmission, and the message server performs related preserve And cleaning operation.
Further, the access such as authentication request message of the step S1 includes:Fixing head, variable header and message Body, message body include client id, user name and password.
Further, the step S2 is further included:The certification message of message server feedback include fixing head and Variable header, variable header include response results.
Further, the step S3 is further included:Subscribe to theme authentication request message include fixing head, variable header and Message body, message body include the subject subscribed to.
Further, the step S5 is further included:The authentication request message that gives out information include fixing head, variable header and Message body, variable header include subject and message identifier.
Further, the step S5 is further included:It gives out information and all correspondences are sent to by the message server order Reader's client.
Further, the step S7 is further included:Unsubscribe theme request message include fixing head, variable header and Message body, message body include the subject quit the subscription of.
Further, the step S8 is further included:It disconnects request message and only includes fixing head, the messenger service Device performs relevant operation according to the value for disconnecting request message fixing head.
It should be noted that for aforementioned each embodiment of the method, in order to be briefly described, therefore it is all expressed as to a system The combination of actions of row, but those skilled in the art should know, the application is not limited by described sequence of movement, because For according to the application, certain some step may be used other sequences or be carried out at the same time.Secondly, those skilled in the art also should Know, embodiment described in this description belongs to preferred embodiment, involved action and unit not necessarily this Shen It please be necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in some embodiment Part, may refer to the associated description of other embodiment.
One of ordinary skill in the art will appreciate that realizing all or part of flow in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the program can be stored in computer read/write memory medium In, the program is when being executed, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, the storage medium can be magnetic Dish, CD, ROM, RAM etc..
The above disclosure is only the preferred embodiments of the present invention, cannot limit the right model of the present invention with this certainly It encloses, therefore equivalent variations made according to the claims of the present invention, is still within the scope of the present invention.

Claims (8)

1. a kind of cloud service message treatment method based on MQTT, which is characterized in that include the following steps:
S1. client sends access authentication and asks to message server end;
S2. the message server feedback access authentication result confirms connection;
S3. the client sends to the message server and subscribes to theme certification request;
S4. the message server feedback subscribes to theme certification request result to the client;
S5. the client certification request that will give out information is sent to the message server;
S6. the message server feeds back the authentication result that gives out information, and the client determines to connect with the message server;
S7. the message server receive the client to the message server sends unsubscribe theme ask and to The client feedback unsubscribes theme request results;
S8. the client disconnects request to message server transmission, and the message server performs related preserve And cleaning operation.
A kind of 2. cloud service message treatment method based on MQTT according to claim 1, which is characterized in that the step The access of S1 such as authentication request message includes:Fixing head, variable header and message body, message body include client id, user Name and password.
A kind of 3. cloud service message treatment method based on MQTT according to claim 1, which is characterized in that the step S2 is further included:The certification message of the message server feedback includes fixing head and variable header, and variable header includes response As a result.
A kind of 4. cloud service message treatment method based on MQTT according to claim 1, which is characterized in that the step S3 is further included:It subscribes to theme authentication request message and includes fixing head, variable header and message body, message body includes the master subscribed to Autograph.
A kind of 5. cloud service message treatment method based on MQTT according to claim 1, which is characterized in that the step S5 is further included:The authentication request message that gives out information includes fixing head, variable header and message body, and variable header includes subject And message identifier.
A kind of 6. cloud service message treatment method based on MQTT according to claim 1, which is characterized in that the step S5 is further included:It gives out information and all corresponding subscriber clients is sent to by the message server.
A kind of 7. cloud service message treatment method based on MQTT according to claim 1, which is characterized in that the step S7 is further included:It unsubscribes theme request message and includes fixing head, variable header and message body, message body includes the master quit the subscription of Autograph.
A kind of 8. cloud service message treatment method based on MQTT according to claim 1, which is characterized in that the step S8 is further included:It disconnects request message and only includes fixing head, the message server is consolidated according to request message is disconnected The value for determining head performs relevant operation.
CN201711230983.8A 2017-11-29 2017-11-29 A kind of cloud service message treatment method based on MQTT Pending CN108173739A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711230983.8A CN108173739A (en) 2017-11-29 2017-11-29 A kind of cloud service message treatment method based on MQTT

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711230983.8A CN108173739A (en) 2017-11-29 2017-11-29 A kind of cloud service message treatment method based on MQTT

Publications (1)

Publication Number Publication Date
CN108173739A true CN108173739A (en) 2018-06-15

Family

ID=62524224

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711230983.8A Pending CN108173739A (en) 2017-11-29 2017-11-29 A kind of cloud service message treatment method based on MQTT

Country Status (1)

Country Link
CN (1) CN108173739A (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108965265A (en) * 2018-06-26 2018-12-07 四川斐讯信息技术有限公司 A kind of chat method and system based on MQTT agreement
CN108965447A (en) * 2018-07-27 2018-12-07 四川爱创科技有限公司 The method and system that data are acquired and remotely controlled
CN109088723A (en) * 2018-10-26 2018-12-25 四川长虹电器股份有限公司 A kind of long-range control method based on MQTT agreement
CN109544789A (en) * 2019-01-23 2019-03-29 小雨科技(上海)有限公司 A kind of automatic concurrent shipment system
CN110278248A (en) * 2019-05-29 2019-09-24 平安科技(深圳)有限公司 Testament message distributing method, device and computer readable storage medium
CN111385346A (en) * 2019-04-12 2020-07-07 鸿合科技股份有限公司 Interactive answer method, client and electronic equipment
CN112104720A (en) * 2020-09-03 2020-12-18 国电南瑞科技股份有限公司 MQTT double-Broker data interaction method and system suitable for edge Internet of things terminal
CN113012323A (en) * 2021-03-19 2021-06-22 四川虹美智能科技有限公司 Intelligent vending machine door lock control method, intelligent vending machine and system
CN113593720A (en) * 2020-04-30 2021-11-02 京东方科技集团股份有限公司 Remote consultation control method and system, computer equipment and medium
CN115378989A (en) * 2022-08-10 2022-11-22 上海黑眸智能科技有限责任公司 MQTT topic subscription system, method, terminal and medium based on wake-up channel

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106412101A (en) * 2016-10-28 2017-02-15 浪潮软件集团有限公司 MQTT protocol-based user-oriented message pushing method
CN106657130A (en) * 2017-01-09 2017-05-10 上海浦东软件园汇智软件发展有限公司 Access authentication method and access authentication equipment based on MQTT
US20170244657A1 (en) * 2016-02-22 2017-08-24 International Business Machines Corporation Message delivery in a message system
WO2017186260A1 (en) * 2016-04-25 2017-11-02 Huawei Technologies Co., Ltd. Edge server and method of operating an edge server

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170244657A1 (en) * 2016-02-22 2017-08-24 International Business Machines Corporation Message delivery in a message system
WO2017186260A1 (en) * 2016-04-25 2017-11-02 Huawei Technologies Co., Ltd. Edge server and method of operating an edge server
CN106412101A (en) * 2016-10-28 2017-02-15 浪潮软件集团有限公司 MQTT protocol-based user-oriented message pushing method
CN106657130A (en) * 2017-01-09 2017-05-10 上海浦东软件园汇智软件发展有限公司 Access authentication method and access authentication equipment based on MQTT

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108965265A (en) * 2018-06-26 2018-12-07 四川斐讯信息技术有限公司 A kind of chat method and system based on MQTT agreement
CN108965447A (en) * 2018-07-27 2018-12-07 四川爱创科技有限公司 The method and system that data are acquired and remotely controlled
CN109088723A (en) * 2018-10-26 2018-12-25 四川长虹电器股份有限公司 A kind of long-range control method based on MQTT agreement
CN109088723B (en) * 2018-10-26 2021-08-06 四川长虹电器股份有限公司 Remote control method based on MQTT protocol
CN109544789A (en) * 2019-01-23 2019-03-29 小雨科技(上海)有限公司 A kind of automatic concurrent shipment system
CN109544789B (en) * 2019-01-23 2024-05-14 福历科技(上海)有限公司 Automatic concurrent shipment system
CN111385346A (en) * 2019-04-12 2020-07-07 鸿合科技股份有限公司 Interactive answer method, client and electronic equipment
CN110278248A (en) * 2019-05-29 2019-09-24 平安科技(深圳)有限公司 Testament message distributing method, device and computer readable storage medium
CN110278248B (en) * 2019-05-29 2022-04-22 平安科技(深圳)有限公司 Method and device for distributing testament information and computer readable storage medium
CN113593720A (en) * 2020-04-30 2021-11-02 京东方科技集团股份有限公司 Remote consultation control method and system, computer equipment and medium
CN112104720B (en) * 2020-09-03 2024-04-26 国电南瑞科技股份有限公司 MQTT double-Broker data interaction method and system suitable for edge internet of things terminal
CN112104720A (en) * 2020-09-03 2020-12-18 国电南瑞科技股份有限公司 MQTT double-Broker data interaction method and system suitable for edge Internet of things terminal
CN113012323A (en) * 2021-03-19 2021-06-22 四川虹美智能科技有限公司 Intelligent vending machine door lock control method, intelligent vending machine and system
CN115378989A (en) * 2022-08-10 2022-11-22 上海黑眸智能科技有限责任公司 MQTT topic subscription system, method, terminal and medium based on wake-up channel
CN115378989B (en) * 2022-08-10 2023-08-15 深圳华芯信息技术股份有限公司 MQTT theme subscription system, method, terminal and medium based on wake-up channel

Similar Documents

Publication Publication Date Title
CN108173739A (en) A kind of cloud service message treatment method based on MQTT
WO2019205907A1 (en) Intelligent device communication platform based on mqtt message protocol
KR101366807B1 (en) A method and system for remotely accessing devices in a network
TW544625B (en) Method and system for portably enabling awareness, touring, and conferencing over the world-wide web using proxies and shared-state servers
CN112738140B (en) Video stream transmission method, device, storage medium and equipment based on WebRTC
KR102208935B1 (en) Messaging api over http protocol to establish context for data exchange
KR101859235B1 (en) System and method of multi-media conferencing between universal plug and play (upnp) enabled telephony devices and wireless area network (wan) devices
CN106230896A (en) A kind of information push method, Apparatus and system
CN110266810B (en) Message receiving method, device and storage medium based on MQTT protocol
CN106210084B (en) A kind of message inserting method based on MQTT
CN102664899B (en) A kind of method for processing business, Apparatus and system
US9277027B2 (en) Method for providing message and device therefor
US20060271686A1 (en) Combining SIP requests with SIP responses
EP3235189B1 (en) Negotiation of message chunk size for message session relay protocol session
US20160014214A1 (en) Pulling information from information sources via refer requests
CN109040017B (en) Intelligent customer service system based on MQTT and HTTP and implementation method
CN102137140A (en) Method, device and system for processing streaming services
US8315247B2 (en) System and method for providing registration-coupled subscriptions in a session initiation protocol (SIP) environment
CN110380967B (en) SSE technology-based server message pushing method
CN110971873B (en) Real-time monitoring method, monitoring system and storage medium
CN108156253A (en) A kind of data transmission method, apparatus and system
CN116308671A (en) Online bidding method based on MQTT protocol, electronic equipment and storage medium
CN104967556A (en) Chat device based on social contact and communication method thereof
KR101455196B1 (en) System and method for presence service interconnect service in ims
CN105959402A (en) Method for solving network push

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20180615

RJ01 Rejection of invention patent application after publication