{"id":23149,"date":"2023-08-29T22:46:39","date_gmt":"2023-08-29T14:46:39","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=23149"},"modified":"2023-08-29T22:46:44","modified_gmt":"2023-08-29T14:46:44","slug":"mxygzylhgc","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/23149.html","title":{"rendered":"MQTT\u534f\u8bae\u5de5\u4f5c\u539f\u7406\u548c\u8fc7\u7a0b"},"content":{"rendered":"\n

\u3000\u3000\u968f\u7740\u7269\u8054\u7f51\u7684\u8fc5\u901f\u53d1\u5c55\uff0c\u5404\u79cd\u667a\u80fd\u8bbe\u5907\u7684\u8fde\u63a5\u548c\u901a\u4fe1\u6210\u4e3a\u4e86\u5173\u952e\u95ee\u9898\u3002MQTT(Message Queuing Telemetry Transport)\u534f\u8bae\u4f5c\u4e3a\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u3001\u53ef\u9760\u7684\u3001\u7b80\u5355\u7684\u3001\u9ad8\u6548\u7684\u7269\u8054\u7f51\u901a\u4fe1\u534f\u8bae\uff0c\u88ab\u5e7f\u6cdb\u5e94\u7528\u4e8e\u7269\u8054\u7f51\u9886\u57df\u3002<\/strong>\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecdMQTT\u534f\u8bae\u7684\u5de5\u4f5c\u539f\u7406\u548c\u8fc7\u7a0b\uff0c\u5e2e\u52a9\u8bfb\u8005\u6df1\u5165\u4e86\u89e3\u8be5\u534f\u8bae\u7684\u6838\u5fc3\u6982\u5ff5\u548c\u8fd0\u884c\u673a\u5236\u3002<\/p>\n\n\n\n

\u3000\u3000\u4e00\u3001MQTT\u534f\u8bae\u6982\u8ff0<\/h2>\n\n\n\n

\u3000\u3000MQTT\u534f\u8bae\u662f\u4e00\u79cd\u53d1\u5e03-\u8ba2\u9605\u6a21\u5f0f\u7684\u901a\u4fe1\u534f\u8bae\uff0c\u57fa\u4e8eTCP\/IP\u534f\u8bae\u6808\u3002\u5b83\u6700\u521d\u7531IBM\u5f00\u53d1\uff0c\u73b0\u5df2\u6210\u4e3aOASIS(Organization for the Advancement of Structured Information Standards)\u6807\u51c6\uff0c\u5e76\u5f97\u5230\u4e86\u5e7f\u6cdb\u7684\u5e94\u7528\u548c\u652f\u6301\u3002<\/strong>MQTT\u534f\u8bae\u4ee5\u5176\u4f4e\u5e26\u5bbd\u3001\u4f4e\u529f\u8017\u3001\u9ad8\u6548\u7684\u7279\u70b9\uff0c\u6210\u4e3a\u7269\u8054\u7f51\u9886\u57df\u7684\u9996\u9009\u901a\u4fe1\u534f\u8bae\u3002<\/p>\n\n\n\n

\u3000\u3000\u4e8c\u3001MQTT\u534f\u8bae\u7684\u5de5\u4f5c\u539f\u7406<\/h2>\n\n\n\n

\u3000\u30001. \u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u5efa\u7acb\u8fde\u63a5<\/h3>\n\n\n\n

\u3000\u3000MQTT\u534f\u8bae\u901a\u8fc7TCP\/IP\u534f\u8bae\u6808\u8fdb\u884c\u901a\u4fe1\uff0c\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u9700\u8981\u5efa\u7acb\u4e00\u4e2a\u6301\u4e45\u7684\u8fde\u63a5\u3002\u5ba2\u6237\u7aef\u4f7f\u7528\u56fa\u5b9a\u7684\u7aef\u53e3\u53f7\u8fde\u63a5\u5230\u670d\u52a1\u5668\uff0c\u5efa\u7acb\u8d77\u4e00\u4e2a\u53ef\u9760\u7684\u901a\u4fe1\u901a\u9053\u3002<\/p>\n\n\n\n

\u3000\u30002. \u5ba2\u6237\u7aef\u8ba2\u9605\u4e3b\u9898<\/h3>\n\n\n\n

\u3000\u3000\u5728MQTT\u534f\u8bae\u4e2d\uff0c\u4e3b\u9898(Topic)\u662f\u6d88\u606f\u7684\u5206\u7c7b\u6807\u7b7e\uff0c\u5ba2\u6237\u7aef\u53ef\u4ee5\u8ba2\u9605\u611f\u5174\u8da3\u7684\u4e3b\u9898\u3002\u8ba2\u9605\u4e3b\u9898\u7684\u8fc7\u7a0b\u5b9e\u9645\u4e0a\u662f\u5ba2\u6237\u7aef\u5411\u670d\u52a1\u5668\u53d1\u9001\u4e00\u4e2a\u8ba2\u9605\u8bf7\u6c42\uff0c\u670d\u52a1\u5668\u6536\u5230\u8bf7\u6c42\u540e\u5c06\u5ba2\u6237\u7aef\u6dfb\u52a0\u5230\u76f8\u5e94\u4e3b\u9898\u7684\u8ba2\u9605\u5217\u8868\u4e2d\u3002<\/p>\n\n\n\n

\u3000\u30003. \u670d\u52a1\u5668\u53d1\u5e03\u6d88\u606f<\/h3>\n\n\n\n

\u3000\u3000\u5f53\u670d\u52a1\u5668\u6709\u6d88\u606f\u9700\u8981\u53d1\u5e03\u65f6\uff0c\u5b83\u4f1a\u5c06\u6d88\u606f\u53d1\u9001\u7ed9\u6240\u6709\u8ba2\u9605\u4e86\u8be5\u4e3b\u9898\u7684\u5ba2\u6237\u7aef\u3002\u6d88\u606f\u53ef\u4ee5\u662f\u4efb\u610f\u683c\u5f0f\u7684\u6570\u636e\uff0c\u4f8b\u5982\u6e29\u5ea6\u3001\u6e7f\u5ea6\u7b49\u4f20\u611f\u5668\u6570\u636e\u3002<\/p>\n\n\n\n

\u3000\u30004. \u5ba2\u6237\u7aef\u63a5\u6536\u6d88\u606f<\/h3>\n\n\n\n

\u3000\u3000\u5ba2\u6237\u7aef\u5728\u8ba2\u9605\u4e3b\u9898\u540e\uff0c\u4f1a\u6301\u7eed\u5730\u63a5\u6536\u670d\u52a1\u5668\u53d1\u5e03\u7684\u6d88\u606f\u3002\u63a5\u6536\u5230\u7684\u6d88\u606f\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u5904\u7406\u548c\u89e3\u6790\uff0c\u4f8b\u5982\u66f4\u65b0\u8bbe\u5907\u72b6\u6001\u3001\u751f\u6210\u62a5\u8868\u7b49\u3002<\/p>\n\n\n\n

\u3000\u30005. \u5ba2\u6237\u7aef\u53d1\u5e03\u6d88\u606f<\/h3>\n\n\n\n

\u3000\u3000\u9664\u4e86\u63a5\u6536\u6d88\u606f\uff0c\u5ba2\u6237\u7aef\u4e5f\u53ef\u4ee5\u5411\u670d\u52a1\u5668\u53d1\u5e03\u6d88\u606f\u3002\u5ba2\u6237\u7aef\u5c06\u6d88\u606f\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u65f6\uff0c\u9700\u8981\u6307\u5b9a\u4e00\u4e2a\u4e3b\u9898\uff0c\u670d\u52a1\u5668\u5c06\u6839\u636e\u4e3b\u9898\u5c06\u6d88\u606f\u53d1\u9001\u7ed9\u8ba2\u9605\u4e86\u8be5\u4e3b\u9898\u7684\u5ba2\u6237\u7aef\u3002<\/p>\n\n\n\n

\u3000\u3000\u4e09\u3001MQTT\u534f\u8bae\u7684\u8fc7\u7a0b\u793a\u4f8b<\/h2>\n\n\n\n

\u3000\u3000\u4e3a\u4e86\u66f4\u597d\u5730\u7406\u89e3MQTT\u534f\u8bae\u7684\u5de5\u4f5c\u8fc7\u7a0b\uff0c\u6211\u4eec\u4ee5\u4e00\u4e2a\u7b80\u5355\u7684\u7269\u8054\u7f51\u5e94\u7528\u4e3a\u4f8b\u8fdb\u884c\u8bf4\u660e\u3002<\/p>\n\n\n\n

\u3000\u3000\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u6e29\u5ea6\u4f20\u611f\u5668\u8bbe\u5907\uff0c\u9700\u8981\u5c06\u6e29\u5ea6\u6570\u636e\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u7531\u5176\u4ed6\u8bbe\u5907\u8fdb\u884c\u8ba2\u9605\u548c\u63a5\u6536\u3002<\/p>\n\n\n\n

\u3000\u30001. \u6e29\u5ea6\u4f20\u611f\u5668\u8bbe\u5907\u8fde\u63a5\u670d\u52a1\u5668<\/h3>\n\n\n\n

\u3000\u3000\u6e29\u5ea6\u4f20\u611f\u5668\u8bbe\u5907\u9996\u5148\u4e0e\u670d\u52a1\u5668\u5efa\u7acb\u8fde\u63a5\uff0c\u5efa\u7acb\u8d77\u4e00\u4e2a\u6301\u4e45\u7684\u901a\u4fe1\u901a\u9053\u3002<\/p>\n\n\n\n

\u3000\u30002. \u6e29\u5ea6\u4f20\u611f\u5668\u8bbe\u5907\u53d1\u5e03\u6e29\u5ea6\u6570\u636e<\/h3>\n\n\n\n

\u3000\u3000\u6e29\u5ea6\u4f20\u611f\u5668\u8bbe\u5907\u5728\u56fa\u5b9a\u65f6\u95f4\u95f4\u9694\u5185\u6d4b\u91cf\u6e29\u5ea6\uff0c\u5e76\u5c06\u6e29\u5ea6\u6570\u636e\u53d1\u5e03\u7ed9\u670d\u52a1\u5668\u3002\u53d1\u5e03\u7684\u6d88\u606f\u5305\u62ec\u4e3b\u9898(\u4f8b\u5982”temperature”)\u548c\u6e29\u5ea6\u6570\u503c\u3002<\/p>\n\n\n\n

\u3000\u30003. \u5176\u4ed6\u8bbe\u5907\u8ba2\u9605\u6e29\u5ea6\u6570\u636e<\/h3>\n\n\n\n

\u3000\u3000\u5176\u4ed6\u8bbe\u5907(\u4f8b\u5982\u624b\u673a\u3001\u7535\u8111\u7b49)\u8ba2\u9605\u4e86\u6e29\u5ea6\u6570\u636e\u7684\u4e3b\u9898\u3002\u5b83\u4eec\u5411\u670d\u52a1\u5668\u53d1\u9001\u8ba2\u9605\u8bf7\u6c42\uff0c\u670d\u52a1\u5668\u5c06\u5176\u6dfb\u52a0\u5230\u6e29\u5ea6\u6570\u636e\u4e3b\u9898\u7684\u8ba2\u9605\u5217\u8868\u4e2d\u3002<\/p>\n\n\n\n

\u3000\u30004. \u5176\u4ed6\u8bbe\u5907\u63a5\u6536\u6e29\u5ea6\u6570\u636e<\/h3>\n\n\n\n

\u3000\u3000\u5f53\u6e29\u5ea6\u4f20\u611f\u5668\u8bbe\u5907\u53d1\u5e03\u6e29\u5ea6\u6570\u636e\u65f6\uff0c\u670d\u52a1\u5668\u5c06\u6570\u636e\u53d1\u9001\u7ed9\u6240\u6709\u8ba2\u9605\u4e86\u6e29\u5ea6\u6570\u636e\u4e3b\u9898\u7684\u8bbe\u5907\u3002\u5176\u4ed6\u8bbe\u5907\u63a5\u6536\u5230\u6570\u636e\u540e\uff0c\u53ef\u4ee5\u8fdb\u884c\u76f8\u5e94\u7684\u5904\u7406\u548c\u663e\u793a\uff0c\u4f8b\u5982\u663e\u793a\u5b9e\u65f6\u6e29\u5ea6\u3001\u751f\u6210\u6e29\u5ea6\u66f2\u7ebf\u7b49\u3002<\/p>\n\n\n\n

\u3000\u30005. \u5176\u4ed6\u8bbe\u5907\u5411\u670d\u52a1\u5668\u53d1\u5e03\u63a7\u5236\u6307\u4ee4<\/h3>\n\n\n\n

\u3000\u3000\u5176\u4ed6\u8bbe\u5907\u53ef\u4ee5\u5411\u670d\u52a1\u5668\u53d1\u5e03\u63a7\u5236\u6307\u4ee4\uff0c\u4f8b\u5982\u8bbe\u7f6e\u6e29\u5ea6\u62a5\u8b66\u9608\u503c\u3001\u4fee\u6539\u91c7\u6837\u9891\u7387\u7b49\u3002\u8bbe\u5907\u53d1\u9001\u6307\u4ee4\u65f6\u9700\u8981\u6307\u5b9a\u4e00\u4e2a\u4e3b\u9898\uff0c\u670d\u52a1\u5668\u5c06\u6839\u636e\u4e3b\u9898\u5c06\u6307\u4ee4\u53d1\u9001\u7ed9\u8ba2\u9605\u4e86\u8be5\u4e3b\u9898\u7684\u8bbe\u5907\u3002<\/p>\n\n\n\n

\u3000\u3000\u7ed3\u8bba\uff1a<\/h2>\n\n\n\n

\u3000\u3000MQTT\u534f\u8bae\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u3001\u9ad8\u6548\u7684\u7269\u8054\u7f51\u901a\u4fe1\u534f\u8bae\uff0c\u901a\u8fc7\u53d1\u5e03-\u8ba2\u9605\u6a21\u5f0f\u5b9e\u73b0\u8bbe\u5907\u4e4b\u95f4\u7684\u53ef\u9760\u901a\u4fe1\u3002\u5b83\u7684\u5de5\u4f5c\u539f\u7406\u7b80\u5355\u660e\u4e86\uff0c\u53ef\u9760\u6027\u9ad8\uff0c\u9002\u7528\u4e8e\u5404\u79cd\u7269\u8054\u7f51\u5e94\u7528\u573a\u666f\u3002<\/strong>\u968f\u7740\u7269\u8054\u7f51\u7684\u5feb\u901f\u53d1\u5c55\uff0cMQTT\u534f\u8bae\u5c06\u5728\u66f4\u591a\u7684\u667a\u80fd\u8bbe\u5907\u4e2d\u5f97\u5230\u5e7f\u6cdb\u5e94\u7528\uff0c\u5e26\u6765\u66f4\u52a0\u4fbf\u6377\u548c\u667a\u80fd\u7684\u751f\u6d3b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u968f\u7740\u7269\u8054\u7f51\u7684\u8fc5\u901f\u53d1\u5c55\uff0c\u5404\u79cd\u667a\u80fd\u8bbe\u5907\u7684\u8fde\u63a5\u548c\u901a\u4fe1\u6210\u4e3a\u4e86\u5173\u952e\u95ee\u9898\u3002MQTT(Message Queuing Telemetry Transport)\u534f\u8bae\u4f5c\u4e3a\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u3001\u53ef\u9760\u7684\u3001\u7b80\u5355\u7684\u3001\u9ad8\u6548\u7684\u7269\u8054\u7f51\u901a\u4fe1\u534f\u8bae\uff0c\u88ab\u5e7f\u6cdb\u5e94\u7528\u4e8e\u7269\u8054\u7f51\u9886\u57df\u3002<\/p>\n","protected":false},"author":1,"featured_media":3671,"comment_status":"closed","ping_status":"closed","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-23149","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\/23149","targetHints":{"allow":["GET"]}}],"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=23149"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/23149\/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=23149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=23149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=23149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}