{"id":6802,"date":"2023-07-19T09:14:13","date_gmt":"2023-07-19T01:14:13","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=6802"},"modified":"2023-07-19T09:14:16","modified_gmt":"2023-07-19T01:14:16","slug":"wlwyycsbdsjfwzmsx","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/6802.html","title":{"rendered":"\u7269\u8054\u7f51\u5e94\u7528\u5c42\u8bbe\u5907\u7684\u6570\u636e\u8bbf\u95ee\u600e\u4e48\u5b9e\u73b0\uff1f"},"content":{"rendered":"\n
\u3000\u3000\u968f\u7740\u7269\u8054\u7f51\u6280\u672f\u7684\u4e0d\u65ad\u53d1\u5c55\uff0c\u8d8a\u6765\u8d8a\u591a\u7684\u8bbe\u5907\u53ef\u4ee5\u901a\u8fc7\u7f51\u7edc\u4e92\u76f8\u8fde\u63a5\u3002\u8fd9\u4e9b\u8bbe\u5907\u53ef\u4ee5\u901a\u8fc7\u4e92\u8054\u7f51\u5171\u4eab\u6570\u636e\u548c\u4fe1\u606f\uff0c\u4f46\u662f\u5982\u4f55\u5b9e\u73b0\u8fd9\u4e2a\u8fc7\u7a0b\u5462?\u672c\u6587\u5c06\u4ecb\u7ecd\u7269\u8054\u7f51\u5e94\u7528\u5c42\u8bbe\u5907\u7684\u6570\u636e\u8bbf\u95ee\u5b9e\u73b0\u65b9\u6cd5\u3002<\/p>\n\n\n\n
\u3000\u3000\u7269\u8054\u7f51\u5e94\u7528\u5c42\u8bbe\u5907\u662f\u6307\u8fde\u63a5\u5230\u7269\u8054\u7f51\u7684\u8bbe\u5907\uff0c\u5305\u62ec\u4f20\u611f\u5668\u3001\u6267\u884c\u5668\u3001\u63a7\u5236\u5668\u7b49\u3002\u8fd9\u4e9b\u8bbe\u5907\u53ef\u4ee5\u6536\u96c6\u73af\u5883\u6570\u636e\u3001\u63a7\u5236\u8bbe\u5907\u3001\u6267\u884c\u4efb\u52a1\u7b49\u3002\u5728\u7269\u8054\u7f51\u4e2d\uff0c\u5e94\u7528\u5c42\u8bbe\u5907\u53ef\u4ee5\u901a\u8fc7\u7f51\u7edc\u8fde\u63a5\u5230\u5176\u4ed6\u8bbe\u5907\u6216\u4e91\u7aef\u670d\u52a1\u5668\uff0c\u5b9e\u73b0\u6570\u636e\u5171\u4eab\u548c\u901a\u4fe1\u3002<\/p>\n\n\n\n
\u3000\u3000HTTP\u662f\u4e00\u79cd\u5e94\u7528\u5c42\u534f\u8bae\uff0c\u662f\u8bbf\u95eeWeb\u670d\u52a1\u5668\u7684\u6807\u51c6\u534f\u8bae\u3002RESTful API\u662f\u4e00\u79cd\u57fa\u4e8eHTTP\u534f\u8bae\u7684API\u8bbe\u8ba1\u98ce\u683c\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5bf9Web\u8d44\u6e90\u7684\u8bbf\u95ee\u548c\u64cd\u4f5c\u3002\u5728\u7269\u8054\u7f51\u5e94\u7528\u5c42\u8bbe\u5907\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528HTTP\/RESTful API\u5b9e\u73b0\u6570\u636e\u7684\u8bbf\u95ee\u548c\u64cd\u4f5c\u3002<\/p>\n\n\n\n
\u3000\u3000\u4f7f\u7528HTTP\/RESTful API\u5b9e\u73b0\u6570\u636e\u8bbf\u95ee\u65f6\uff0c\u9700\u8981\u5b9a\u4e49API\u7684\u8d44\u6e90\u8def\u5f84\u548c\u8bf7\u6c42\u65b9\u5f0f\u3002\u4f8b\u5982\uff0c\u4f7f\u7528GET\u8bf7\u6c42\u8bbf\u95ee\u8bbe\u5907\u7684\u4f20\u611f\u5668\u6570\u636e\uff0c\u53ef\u4ee5\u5b9a\u4e49\u5982\u4e0b\u7684\u8d44\u6e90\u8def\u5f84\uff1a<\/p>\n\n\n\n
\u3000\u3000“`<\/p>\n\n\n\n
\u3000\u3000http:\/\/example.com\/devices\/device_id\/sensors\/sensor_id<\/p>\n\n\n\n
\u3000\u3000“`<\/p>\n\n\n\n
\u3000\u3000\u5176\u4e2d\uff0cdevice_id\u4e3a\u8bbe\u5907\u7684\u552f\u4e00\u6807\u8bc6\u7b26\uff0csensor_id\u4e3a\u4f20\u611f\u5668\u7684\u552f\u4e00\u6807\u8bc6\u7b26\u3002\u901a\u8fc7\u8bbf\u95ee\u8be5\u8d44\u6e90\u8def\u5f84\uff0c\u53ef\u4ee5\u83b7\u53d6\u8bbe\u5907\u7684\u4f20\u611f\u5668\u6570\u636e\u3002\u540c\u6837\uff0c\u53ef\u4ee5\u4f7f\u7528PUT\u3001POST\u3001DELETE\u7b49\u8bf7\u6c42\u65b9\u5f0f\u5b9e\u73b0\u5bf9\u8bbe\u5907\u6570\u636e\u7684\u4fee\u6539\u3001\u6dfb\u52a0\u548c\u5220\u9664\u64cd\u4f5c\u3002<\/p>\n\n\n\n
\u3000\u3000MQTT\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u6d88\u606f\u4f20\u8f93\u534f\u8bae\uff0c\u9002\u7528\u4e8e\u7269\u8054\u7f51\u8bbe\u5907\u4e4b\u95f4\u7684\u901a\u4fe1\u3002MQTT\u534f\u8bae\u53ef\u4ee5\u5b9e\u73b0\u8bbe\u5907\u4e4b\u95f4\u7684\u5b9e\u65f6\u6570\u636e\u4f20\u8f93\u548c\u6d88\u606f\u901a\u77e5\u3002\u5728MQTT\u534f\u8bae\u4e2d\uff0c\u8bbe\u5907\u53ef\u4ee5\u53d1\u5e03\u548c\u8ba2\u9605\u6d88\u606f\u4e3b\u9898\uff0c\u5b9e\u73b0\u8bbe\u5907\u4e4b\u95f4\u7684\u6570\u636e\u4ea4\u6362\u3002<\/p>\n\n\n\n
\u3000\u3000\u4f7f\u7528MQTT\u534f\u8bae\u5b9e\u73b0\u6570\u636e\u8bbf\u95ee\u65f6\uff0c\u9700\u8981\u5b9a\u4e49\u6d88\u606f\u4e3b\u9898\u548c\u6d88\u606f\u8d1f\u8f7d\u3002\u4f8b\u5982\uff0c\u8bbe\u5907\u53ef\u4ee5\u53d1\u5e03\u5982\u4e0b\u7684\u6d88\u606f\u4e3b\u9898\uff1a<\/p>\n\n\n\n
\u3000\u3000“`<\/p>\n\n\n\n
\u3000\u3000devices\/device_id\/sensors\/sensor_id<\/p>\n\n\n\n
\u3000\u3000“`<\/p>\n\n\n\n
\u3000\u3000\u5176\u4e2d\uff0cdevice_id\u4e3a\u8bbe\u5907\u7684\u552f\u4e00\u6807\u8bc6\u7b26\uff0csensor_id\u4e3a\u4f20\u611f\u5668\u7684\u552f\u4e00\u6807\u8bc6\u7b26\u3002\u8bbe\u5907\u53ef\u4ee5\u5c06\u4f20\u611f\u5668\u6570\u636e\u4f5c\u4e3a\u6d88\u606f\u8d1f\u8f7d\u53d1\u5e03\u5230\u8be5\u4e3b\u9898\uff0c\u5176\u4ed6\u8bbe\u5907\u53ef\u4ee5\u8ba2\u9605\u8be5\u4e3b\u9898\uff0c\u5b9e\u65f6\u83b7\u53d6\u4f20\u611f\u5668\u6570\u636e\u3002<\/p>\n\n\n\n
\u3000\u3000CoAP\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u5e94\u7528\u5c42\u534f\u8bae\uff0c\u9002\u7528\u4e8e\u7269\u8054\u7f51\u8bbe\u5907\u4e4b\u95f4\u7684\u901a\u4fe1\u3002CoAP\u534f\u8bae\u53ef\u4ee5\u5b9e\u73b0\u8bbe\u5907\u4e4b\u95f4\u7684\u5b9e\u65f6\u6570\u636e\u4f20\u8f93\u548c\u8d44\u6e90\u64cd\u4f5c\u3002\u5728CoAP\u534f\u8bae\u4e2d\uff0c\u8bbe\u5907\u53ef\u4ee5\u5b9a\u4e49\u8d44\u6e90\u8def\u5f84\u548c\u8bf7\u6c42\u65b9\u5f0f\uff0c\u5b9e\u73b0\u5bf9\u8bbe\u5907\u8d44\u6e90\u7684\u8bbf\u95ee\u548c\u64cd\u4f5c\u3002<\/p>\n\n\n\n
\u3000\u3000\u4f7f\u7528CoAP\u534f\u8bae\u5b9e\u73b0\u6570\u636e\u8bbf\u95ee\u65f6\uff0c\u9700\u8981\u5b9a\u4e49\u8d44\u6e90\u8def\u5f84\u548c\u8bf7\u6c42\u65b9\u5f0f\u3002\u4f8b\u5982\uff0c\u4f7f\u7528GET\u8bf7\u6c42\u8bbf\u95ee\u8bbe\u5907\u7684\u4f20\u611f\u5668\u6570\u636e\uff0c\u53ef\u4ee5\u5b9a\u4e49\u5982\u4e0b\u7684\u8d44\u6e90\u8def\u5f84\uff1a<\/p>\n\n\n\n
\u3000\u3000“`<\/p>\n\n\n\n
\u3000\u3000coap:\/\/example.com\/devices\/device_id\/sensors\/sensor_id<\/p>\n\n\n\n
\u3000\u3000“`<\/p>\n\n\n\n
\u3000\u3000\u5176\u4e2d\uff0cdevice_id\u4e3a\u8bbe\u5907\u7684\u552f\u4e00\u6807\u8bc6\u7b26\uff0csensor_id\u4e3a\u4f20\u611f\u5668\u7684\u552f\u4e00\u6807\u8bc6\u7b26\u3002\u901a\u8fc7\u8bbf\u95ee\u8be5\u8d44\u6e90\u8def\u5f84\uff0c\u53ef\u4ee5\u83b7\u53d6\u8bbe\u5907\u7684\u4f20\u611f\u5668\u6570\u636e\u3002\u540c\u6837\uff0c\u53ef\u4ee5\u4f7f\u7528PUT\u3001POST\u3001DELETE\u7b49\u8bf7\u6c42\u65b9\u5f0f\u5b9e\u73b0\u5bf9\u8bbe\u5907\u6570\u636e\u7684\u4fee\u6539\u3001\u6dfb\u52a0\u548c\u5220\u9664\u64cd\u4f5c\u3002<\/p>\n\n\n\n
\u3000\u3000\u7269\u8054\u7f51\u5e94\u7528\u5c42\u8bbe\u5907\u7684\u6570\u636e\u8bbf\u95ee\u53ef\u4ee5\u901a\u8fc7HTTP\/RESTful API\u3001MQTT\u548cCoAP\u534f\u8bae\u5b9e\u73b0\u3002\u4e0d\u540c\u7684\u534f\u8bae\u53ef\u4ee5\u9002\u7528\u4e8e\u4e0d\u540c\u7684\u5e94\u7528\u573a\u666f\uff0c\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u534f\u8bae\u3002\u5728\u5b9e\u73b0\u6570\u636e\u8bbf\u95ee\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u5b89\u5168\u6027\u548c\u53ef\u9760\u6027\uff0c\u786e\u4fdd\u6570\u636e\u4f20\u8f93\u7684\u5b89\u5168\u548c\u7a33\u5b9a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u968f\u7740\u7269\u8054\u7f51\u6280\u672f\u7684\u4e0d\u65ad\u53d1\u5c55\uff0c\u8d8a\u6765\u8d8a\u591a\u7684\u8bbe\u5907\u53ef\u4ee5\u901a\u8fc7\u7f51\u7edc\u4e92\u76f8\u8fde\u63a5\u3002\u8fd9\u4e9b\u8bbe\u5907\u53ef\u4ee5\u901a\u8fc7\u4e92\u8054\u7f51\u5171\u4eab\u6570\u636e\u548c\u4fe1\u606f\uff0c\u4f46\u662f\u5982\u4f55\u5b9e\u73b0\u8fd9\u4e2a\u8fc7\u7a0b\u5462?\u672c\u6587\u5c06\u4ecb\u7ecd\u7269\u8054\u7f51\u5e94\u7528\u5c42\u8bbe\u5907\u7684\u6570\u636e\u8bbf\u95ee\u5b9e\u73b0\u65b9\u6cd5\u3002<\/p>\n","protected":false},"author":1,"featured_media":4132,"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":[40],"class_list":["post-6802","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-wlw"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/6802","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=6802"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/6802\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/4132"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=6802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=6802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=6802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}