{"id":21133,"date":"2023-09-04T15:14:10","date_gmt":"2023-09-04T07:14:10","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=21133"},"modified":"2023-09-04T15:14:10","modified_gmt":"2023-09-04T07:14:10","slug":"iwgmyzaqkkdwlwljfs","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/21133.html","title":{"rendered":"IoT\u7f51\u5173MQTT\uff1a\u4e00\u79cd\u5b89\u5168\uff0c\u53ef\u9760\u7684\u7269\u8054\u7f51\u8fde\u63a5\u65b9\u5f0f"},"content":{"rendered":"

  MQTT\uff08Message Queuing Telemetry Transport\uff09\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u53d1\u5e03\/\u8ba2\u9605\u534f\u8bae\uff0c\u53ef\u4ee5\u7528\u4e8e\u8fde\u63a5\u7269\u8054\u7f51\uff08IoT\uff09\u8bbe\u5907\u548c\u5e94\u7528\u7a0b\u5e8f\u3002\u5b83\u4f7f\u7528\u8f7b\u91cf\u7ea7\u7684\u7f51\u7edc\u534f\u8bae\u548c\u6709\u6548\u7684\u6570\u636e\u4f20\u8f93\u673a\u5236\uff0c\u53ef\u4ee5\u652f\u6301\u5ef6\u8fdf\u654f\u611f\u7684\u5e94\u7528\u7a0b\u5e8f\u3002MQTT\u7684\u7279\u6027\u4f7f\u5176\u6210\u4e3a\u7269\u8054\u7f51\uff08IoT\uff09\u6280\u672f\u7684\u7406\u60f3\u9009\u62e9\uff0c\u53ef\u4ee5\u63d0\u4f9b\u5b89\u5168\uff0c\u53ef\u9760\u7684\u8fde\u63a5\u3002\u672c\u6587\u5c06\u4ecb\u7ecdMQTT\u7684\u5de5\u4f5c\u539f\u7406\uff0c\u4ee5\u53ca\u5b83\u5728\u7269\u8054\u7f51\uff08IoT\uff09\u5e94\u7528\u4e2d\u7684\u4f18\u52bf\u3002<\/p>\n

MQTT\u7684\u5de5\u4f5c\u539f\u7406<\/h2>\n

  MQTT\u662f\u4e00\u79cd\u53d1\u5e03\/\u8ba2\u9605\u534f\u8bae\uff0c\u7531\u5ba2\u6237\u7aef\uff08\u53d1\u5e03\u8005\uff09\u548c\u670d\u52a1\u5668\uff08\u8ba2\u9605\u8005\uff09\u7ec4\u6210\u3002\u5ba2\u6237\u7aef\u53d1\u5e03\u6d88\u606f\uff0c\u670d\u52a1\u5668\u63a5\u6536\u6d88\u606f\uff0c\u7136\u540e\u5c06\u6d88\u606f\u53d1\u9001\u5230\u6240\u6709\u8ba2\u9605\u8005\u3002MQTT\u652f\u6301\u591a\u79cd\u6d88\u606f\u4f20\u8f93\u6a21\u5f0f\uff0c\u5176\u4e2d\u6700\u5e38\u7528\u7684\u662fQoS 0\uff0cQoS 1\u548cQoS 2\u3002<\/p>\n

QoS 0\uff1a\u6700\u591a\u53d1\u9001\u4e00\u6b21<\/h3>\n

  QoS 0\uff08\u6700\u591a\u53d1\u9001\u4e00\u6b21\uff09\u662f\u6700\u7b80\u5355\u7684\u6d88\u606f\u4f20\u8f93\u6a21\u5f0f\u3002\u5ba2\u6237\u7aef\u53d1\u5e03\u6d88\u606f\uff0c\u670d\u52a1\u5668\u63a5\u6536\u5e76\u8f6c\u53d1\u6d88\u606f\uff0c\u4f46\u4e0d\u4fdd\u8bc1\u6d88\u606f\u662f\u5426\u88ab\u63a5\u6536\u3002\u5982\u679c\u6d88\u606f\u4e22\u5931\uff0c\u5ba2\u6237\u7aef\u4e0d\u4f1a\u6536\u5230\u4efb\u4f55\u786e\u8ba4\u3002<\/p>\n

QoS 1\uff1a\u81f3\u5c11\u53d1\u9001\u4e00\u6b21<\/h3>\n

  QoS 1\uff08\u81f3\u5c11\u53d1\u9001\u4e00\u6b21\uff09\u662f\u6700\u5e38\u7528\u7684\u6d88\u606f\u4f20\u8f93\u6a21\u5f0f\u3002\u5ba2\u6237\u7aef\u53d1\u5e03\u6d88\u606f\uff0c\u670d\u52a1\u5668\u63a5\u6536\u5e76\u8f6c\u53d1\u6d88\u606f\uff0c\u5e76\u786e\u8ba4\u6d88\u606f\u662f\u5426\u5df2\u63a5\u6536\u3002\u5982\u679c\u6d88\u606f\u4e22\u5931\uff0c\u5ba2\u6237\u7aef\u5c06\u91cd\u65b0\u53d1\u9001\u6d88\u606f\uff0c\u76f4\u5230\u6536\u5230\u786e\u8ba4\u4e3a\u6b62\u3002<\/p>\n

QoS 2\uff1a\u53ea\u53d1\u9001\u4e00\u6b21<\/h3>\n

  QoS 2\uff08\u53ea\u53d1\u9001\u4e00\u6b21\uff09\u662f\u6700\u53ef\u9760\u7684\u6d88\u606f\u4f20\u8f93\u6a21\u5f0f\u3002\u5ba2\u6237\u7aef\u53d1\u5e03\u6d88\u606f\uff0c\u670d\u52a1\u5668\u63a5\u6536\u5e76\u8f6c\u53d1\u6d88\u606f\uff0c\u5e76\u786e\u8ba4\u6d88\u606f\u662f\u5426\u5df2\u63a5\u6536\u548c\u5904\u7406\u3002\u5982\u679c\u6d88\u606f\u4e22\u5931\uff0c\u5ba2\u6237\u7aef\u5c06\u91cd\u65b0\u53d1\u9001\u6d88\u606f\uff0c\u76f4\u5230\u6536\u5230\u786e\u8ba4\u4e3a\u6b62\u3002<\/p>\n

MQTT\u7684\u4f18\u52bf<\/h2>\n

  MQTT\u7684\u8f7b\u91cf\u7ea7\u7f51\u7edc\u534f\u8bae\u548c\u6709\u6548\u7684\u6570\u636e\u4f20\u8f93\u673a\u5236\u4f7f\u5176\u6210\u4e3a\u7269\u8054\u7f51\uff08IoT\uff09\u6280\u672f\u7684\u7406\u60f3\u9009\u62e9\u3002MQTT\u53ef\u4ee5\u63d0\u4f9b\u5b89\u5168\uff0c\u53ef\u9760\u7684\u8fde\u63a5\uff0c\u5e76\u4e14\u652f\u6301\u591a\u79cd\u6d88\u606f\u4f20\u8f93\u6a21\u5f0f\uff0c\u4f7f\u7269\u8054\u7f51\uff08IoT\uff09\u5e94\u7528\u7a0b\u5e8f\u80fd\u591f\u83b7\u5f97\u66f4\u9ad8\u7684\u53ef\u9760\u6027\u548c\u53ef\u7528\u6027\u3002\u6b64\u5916\uff0cMQTT\u8fd8\u652f\u6301\u8de8\u5e73\u53f0\uff0c\u53ef\u4ee5\u5728\u591a\u79cd\u4e0d\u540c\u7684\u786c\u4ef6\u548c\u8f6f\u4ef6\u5e73\u53f0\u4e0a\u8fd0\u884c\uff0c\u4f7f\u7269\u8054\u7f51\uff08IoT\uff09\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u8de8\u4e0d\u540c\u7684\u786c\u4ef6\u548c\u8f6f\u4ef6\u5e73\u53f0\u8fd0\u884c\u3002<\/p>\n

\u603b\u7ed3<\/h2>\n

  MQTT\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u53d1\u5e03\/\u8ba2\u9605\u534f\u8bae\uff0c\u53ef\u4ee5\u7528\u4e8e\u8fde\u63a5\u7269\u8054\u7f51\uff08IoT\uff09\u8bbe\u5907\u548c\u5e94\u7528\u7a0b\u5e8f\u3002<\/strong>\u5b83\u4f7f\u7528\u8f7b\u91cf\u7ea7\u7684\u7f51\u7edc\u534f\u8bae\u548c\u6709\u6548\u7684\u6570\u636e\u4f20\u8f93\u673a\u5236\uff0c\u53ef\u4ee5\u652f\u6301\u5ef6\u8fdf\u654f\u611f\u7684\u5e94\u7528\u7a0b\u5e8f\u3002MQTT\u7684\u7279\u6027\u4f7f\u5176\u6210\u4e3a\u7269\u8054\u7f51\uff08IoT\uff09\u6280\u672f\u7684\u7406\u60f3\u9009\u62e9\uff0c\u53ef\u4ee5\u63d0\u4f9b\u5b89\u5168\uff0c\u53ef\u9760\u7684\u8fde\u63a5\uff0c\u5e76\u4e14\u652f\u6301\u591a\u79cd\u6d88\u606f\u4f20\u8f93\u6a21\u5f0f\uff0c\u4f7f\u7269\u8054\u7f51\uff08IoT\uff09\u5e94\u7528\u7a0b\u5e8f\u80fd\u591f\u83b7\u5f97\u66f4\u9ad8\u7684\u53ef\u9760\u6027\u548c\u53ef\u7528\u6027\u3002MQTT\u7684\u4f18\u52bf\u4f7f\u5176\u6210\u4e3a\u7269\u8054\u7f51\uff08IoT\uff09\u6280\u672f\u7684\u7406\u60f3\u9009\u62e9\uff0c\u53ef\u4ee5\u63d0\u4f9b\u5b89\u5168\uff0c\u53ef\u9760\u7684\u8fde\u63a5\uff0c\u5e76\u4e14\u652f\u6301\u591a\u79cd\u6d88\u606f\u4f20\u8f93\u6a21\u5f0f\uff0c\u4f7f\u7269\u8054\u7f51\uff08IoT\uff09\u5e94\u7528\u7a0b\u5e8f\u80fd\u591f\u83b7\u5f97\u66f4\u9ad8\u7684\u53ef\u9760\u6027\u548c\u53ef\u7528\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

MQTT\uff08MessageQueuingTelemetryTransport\uff09\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u53d1\u5e03\/\u8ba2\u9605\u534f\u8bae\uff0c\u53ef\u4ee5\u7528\u4e8e\u8fde\u63a5\u7269\u8054\u7f51\uff08IoT\uff09\u8bbe\u5907\u548c\u5e94\u7528\u7a0b\u5e8f\u3002\u5b83\u4f7f\u7528\u8f7b\u91cf\u7ea7\u7684<\/p>\n","protected":false},"author":1,"featured_media":3671,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[46],"class_list":["post-21133","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-m"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/21133"}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=21133"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/21133\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/3671"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=21133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=21133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=21133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}