{"id":6045,"date":"2024-08-01T22:46:19","date_gmt":"2024-08-01T14:46:19","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=6045"},"modified":"2024-08-02T16:31:41","modified_gmt":"2024-08-02T08:31:41","slug":"%e8%bf%90%e7%bb%b4%e5%8a%a0%e8%96%aa%e6%8a%80%e6%9c%af-emqx","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring-boot\/%e8%bf%90%e7%bb%b4%e5%8a%a0%e8%96%aa%e6%8a%80%e6%9c%af-emqx\/","title":{"rendered":"\u8fd0\u7ef4\u52a0\u85aa\u6280\u672f\u2014\u2014EMQX"},"content":{"rendered":"<div class=\"wxsyncmain\">\n<h1 style=\"margin-bottom: 10px; padding-left: 5px; font-size: 15.6px; font-weight: bold; float: left; width: 972.938px; clear: both; line-height: 1.5; color: #000000; font-family: 'Helvetica Neue', Helvetica, Verdana, Arial, sans-serif; letter-spacing: normal; text-align: left; white-space: normal; background-color: #ffffff; border: 0px initial initial;\"><span style=\"vertical-align: middle;\" role=\"heading\" aria-level=\"2\"><span style=\"color: #f73131; font-family: Arial, sans-serif; font-size: 13px; letter-spacing: normal; text-align: start; background-color: #ffffff;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223440660.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-imgfileid=\"100004390\" data-ratio=\"1\" data-type=\"png\" data-w=\"500\" \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223440660.png\" data-imgfileid=\"100004390\" data-ratio=\"1\" data-type=\"png\" data-w=\"500\" \/><\/noscript><\/span><\/span><\/h1>\n<h1 style=\"margin-bottom: 10px; padding-left: 5px; font-size: 15.6px; font-weight: bold; float: left; width: 972.938px; clear: both; line-height: 1.5; color: #000000; font-family: 'Helvetica Neue', Helvetica, Verdana, Arial, sans-serif; letter-spacing: normal; text-align: left; white-space: normal; background-color: #ffffff; border: 0px initial initial;\"><span style=\"vertical-align: middle;\" role=\"heading\" aria-level=\"2\"><span style=\"color: #f73131; font-family: Arial, sans-serif; font-size: 13px; letter-spacing: normal; text-align: start; background-color: #ffffff;\">EMQ X<\/span><span style=\"color: #333333; font-family: Arial, sans-serif; font-size: 13px; letter-spacing: normal; text-align: start; background-color: #ffffff;\">\uff08\u7b80\u79f0 EMQ\uff09\uff0c \u662f\u4e00\u6b3e\u5b8c\u5168\u5f00\u6e90\uff0c\u9ad8\u5ea6\u53ef\u4f38\u7f29\uff0c\u9ad8\u53ef\u7528\u7684\u5206\u5e03\u5f0f MQTT \u6d88\u606f\u670d\u52a1\u5668\uff0c\u540c\u65f6\u4e5f\u652f\u6301 CoAP\/LwM2M \u4e00\u7ad9\u5f0f IoT \u534f\u8bae\u63a5\u5165\u3002<\/span><\/span><\/h1>\n<h1 style=\"margin-bottom: 10px; padding-left: 5px; font-size: 15.6px; font-weight: bold; float: left; width: 972.938px; clear: both; line-height: 1.5; color: #000000; font-family: 'Helvetica Neue', Helvetica, Verdana, Arial, sans-serif; letter-spacing: normal; text-align: left; white-space: normal; background-color: #ffffff; border: 0px initial initial;\"><span style=\"vertical-align: middle;\" role=\"heading\" aria-level=\"2\">EMQX\u7b80\u5355\u5165\u95e8<\/span><\/h1>\n<p style=\"margin: 10px auto;\">\u6700\u8fd1\u9879\u76ee\u4e0a\u4f7f\u7528\u4e86mqtt\u534f\u8bae\u6765\u4f20\u8f93\u6570\u636e\uff0c\u4e4b\u524d\u6ca1\u4e86\u89e3\u8fc7\uff0c\u6545\u7b80\u5355\u5b66\u4e60\u4e0b\uff0c\u672c\u6587\u4f5c\u4e3a\u5b66\u4e60\u8bb0\u5f55\u4ee5\u4fbf\u4e4b\u540e\u590d\u4e60\u4f7f\u7528\u3002<\/p>\n<p style=\"margin: 10px auto;\"><span style=\"font-size: 16px;\"><strong>1.\u4ec0\u4e48\u662fMQTT<\/strong><\/span><\/p>\n<p style=\"margin: 10px auto;\">MQTT\u662f\u4e00\u79cd\u57fa\u4e8e<strong>\u53d1\u5e03\/\u8ba2\u9605\u6a21\u5f0f<\/strong>\u7684<strong>\u8f7b\u91cf\u7ea7\u6d88\u606f\u4f20\u8f93\u534f\u8bae<\/strong>\uff0c\u4e13\u95e8\u9488\u5bf9<strong>\u4f4e\u5e26\u5bbd<\/strong>\u548c<strong>\u4e0d\u7a33\u5b9a\u7f51\u7edc\u73af\u5883<\/strong>\u7684\u7269\u8054\u7f51\u5e94\u7528\u800c\u8bbe\u8ba1\uff0c\u53ef\u4ee5\u7528\u6781\u5c11\u7684\u4ee3\u7801\u4e3a\u8054\u7f51\u8bbe\u5907\u63d0\u4f9b\u5b9e\u65f6\u53ef\u9760\u7684\u6d88\u606f\u670d\u52a1\u3002MQTT \u534f\u8bae\u5e7f\u6cdb\u5e94\u7528\u4e8e\u7269\u8054\u7f51\u3001\u79fb\u52a8\u4e92\u8054\u7f51\u3001\u667a\u80fd\u786c\u4ef6\u3001\u8f66\u8054\u7f51\u3001\u667a\u6167\u57ce\u5e02\u3001\u8fdc\u7a0b\u533b\u7597\u3001\u7535\u529b\u3001\u77f3\u6cb9\u4e0e\u80fd\u6e90\u7b49\u9886\u57df<strong>\u3002<\/strong>\u6309\u7167MQTT\u534f\u8bae\u4f5c\u8005\u7684\u8bf4\u6cd5\uff0cMQTT\u534f\u8bae\u5fc5\u987b\u5177\u5907\u8fd9\u51e0\u70b9\u3002<\/p>\n<ol class=\"list-paddingleft-1\" style=\"padding-left: 40px;\">\n<li style=\"margin-bottom: 1em; list-style: inherit;\">\u7b80\u5355\u5bb9\u6613\u5b9e\u73b0<\/li>\n<li style=\"margin-bottom: 1em; list-style: inherit;\">\u652f\u6301 QoS\uff08\u8bbe\u5907\u7f51\u7edc\u73af\u5883\u590d\u6742\uff09<\/li>\n<li style=\"margin-bottom: 1em; list-style: inherit;\">\u8f7b\u91cf\u4e14\u7701\u5e26\u5bbd\uff08\u56e0\u4e3a\u90a3\u65f6\u5019\u5e26\u5bbd\u5f88\u8d35\uff09<\/li>\n<li style=\"margin-bottom: 1em; list-style: inherit;\">\u6570\u636e\u65e0\u5173\uff08\u4e0d\u5173\u5fc3 Payload \u6570\u636e\u683c\u5f0f\uff09<\/li>\n<li style=\"margin-bottom: 1em; list-style: inherit;\">\u6709\u6301\u7eed\u5730\u4f1a\u8bdd\u611f\u77e5\u80fd\u529b\uff08\u65f6\u523b\u77e5\u9053\u8bbe\u5907\u662f\u5426\u5728\u7ebf<\/li>\n<\/ol>\n<p style=\"margin: 10px auto;\">\u800cMQTT\u534f\u8bae\u51ed\u501f\u7740\u8f7b\u91cf\u9ad8\u6548\u3001\u53ef\u9760\u7684\u6d88\u606f\u4f20\u9012\u3001\u6d77\u91cf\u8fde\u63a5\u652f\u6301\u3001\u5b89\u5168\u7684\u53cc\u5411\u901a\u4fe1\u7b49\u4f18\u70b9\u5df2\u6210\u4e3a\u7269\u8054\u7f51\u884c\u4e1a\u7684\u9996\u9009\u534f\u8bae\u3002<\/p>\n<p style=\"margin: 10px auto;\"><span style=\"font-size: 16px;\"><strong>2.MQTT\u5de5\u4f5c\u539f\u7406<\/strong><\/span><\/p>\n<p style=\"margin: 10px auto;\"><strong>2.1 \u57fa\u7840\u6982\u5ff5<\/strong><\/p>\n<p style=\"margin: 10px auto;\">MQTT\u5ba2\u6237\u7aef\uff1a\u4efb\u4f55\u8fd0\u884c MQTT\u5ba2\u6237\u7aef\u5e93\u7684\u5e94\u7528\u6216\u8bbe\u5907\u90fd\u662f MQTT \u5ba2\u6237\u7aef\u3002\u4f8b\u5982\uff0c\u4f7f\u7528 MQTT \u7684\u5373\u65f6\u901a\u8baf\u5e94\u7528\u662f\u5ba2\u6237\u7aef\uff0c\u4f7f\u7528 MQTT \u4e0a\u62a5\u6570\u636e\u7684\u5404\u79cd\u4f20\u611f\u5668\u662f\u5ba2\u6237\u7aef\uff0c\u5404\u79cd MQTT\u6d4b\u8bd5\u5de5\u5177\u4e5f\u662f\u5ba2\u6237\u7aef\u3002<\/p>\n<p style=\"margin: 10px auto;\">MQTT Broker: MQTT Broker \u662f\u8d1f\u8d23\u5904\u7406\u5ba2\u6237\u7aef\u8bf7\u6c42\u7684\u5173\u952e\u7ec4\u4ef6\uff0c\u5305\u62ec\u5efa\u7acb\u8fde\u63a5\u3001\u65ad\u5f00\u8fde\u63a5\u3001\u8ba2\u9605\u548c\u53d6\u6d88\u8ba2\u9605\u7b49\u64cd\u4f5c\uff0c\u540c\u65f6\u8fd8\u8d1f\u8d23\u6d88\u606f\u7684\u8f6c\u53d1\u3002(\u800cEMQX\u6700\u4e3a\u4f18\u79c0\u7684mqtt broker\u662f\u9996\u9009\u7684\u5b66\u4e60\u5bf9\u8c61\u3002\u672c\u6587\u4e5f\u662f\u57fa\u4e8eemqx\u6765\u8fdb\u884c\u5b66\u4e60\u4ecb\u7ecd\u7684\u3002)<\/p>\n<p style=\"margin: 10px auto;\">\u53d1\u5e03\u8ba2\u9605\u6a21\u5f0f\uff1a\u53d1\u5e03-\u8ba2\u9605\u6a21\u5f0f\u4e0e\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\u6a21\u5f0f\u7684\u4e0d\u540c\u4e4b\u5904\u5728\u4e8e\uff0c\u5b83\u5c06\u53d1\u9001\u6d88\u606f\u7684\u5ba2\u6237\u7aef\uff08\u53d1\u5e03\u8005\uff09\u548c\u63a5\u6536\u6d88\u606f\u7684\u5ba2\u6237\u7aef\uff08\u8ba2\u9605\u8005\uff09\u8fdb\u884c\u4e86\u89e3\u8026\u3002\u53d1\u5e03\u8005\u548c\u8ba2\u9605\u8005\u4e4b\u95f4\u65e0\u9700\u5efa\u7acb\u76f4\u63a5\u8fde\u63a5\uff0c\u800c\u662f\u901a\u8fc7 MQTT Broker \u6765\u8d1f\u8d23\u6d88\u606f\u7684\u8def\u7531\u548c\u5206\u53d1\u3002<\/p>\n<p style=\"margin: 10px auto;\">\u4e3b\u9898\uff1aMQTT \u534f\u8bae\u6839\u636e\u4e3b\u9898\u6765\u8f6c\u53d1\u6d88\u606f\u3002\u4e3b\u9898\u901a\u8fc7<code style=\"margin-right: 3px; margin-left: 3px; padding-right: 5px; padding-left: 5px; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace, sans-serif; font-size: 12px; line-height: 1.8; display: inline-block; overflow-x: auto; vertical-align: middle; border-radius: 3px; background-color: #fbe5e1; color: #c0341d; border-width: initial !important; border-style: none !important; border-color: initial !important;\">\/<\/code>\u6765\u533a\u5206\u5c42\u7ea7\uff0cMQTT \u4e3b\u9898\u652f\u6301\u4ee5\u4e0b\u4e24\u79cd\u901a\u914d\u7b26\uff1a<code style=\"margin-right: 3px; margin-left: 3px; padding-right: 5px; padding-left: 5px; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace, sans-serif; font-size: 12px; line-height: 1.8; display: inline-block; overflow-x: auto; vertical-align: middle; border-radius: 3px; background-color: #fbe5e1; color: #c0341d; border-width: initial !important; border-style: none !important; border-color: initial !important;\">+<\/code>\u548c<code style=\"margin-right: 3px; margin-left: 3px; padding-right: 5px; padding-left: 5px; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace, sans-serif; font-size: 12px; line-height: 1.8; display: inline-block; overflow-x: auto; vertical-align: middle; border-radius: 3px; background-color: #fbe5e1; color: #c0341d; border-width: initial !important; border-style: none !important; border-color: initial !important;\">#<\/code>\u30021. <code style=\"margin-right: 3px; margin-left: 3px; padding-right: 5px; padding-left: 5px; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace, sans-serif; font-size: 12px; line-height: 1.8; display: inline-block; overflow-x: auto; vertical-align: middle; border-radius: 3px; background-color: #fbe5e1; color: #c0341d; border-width: initial !important; border-style: none !important; border-color: initial !important;\">+<\/code>\uff1a\u8868\u793a\u5355\u5c42\u901a\u914d\u7b26\uff0c\u4f8b\u5982<code style=\"margin-right: 3px; margin-left: 3px; padding-right: 5px; padding-left: 5px; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace, sans-serif; font-size: 12px; line-height: 1.8; display: inline-block; overflow-x: auto; vertical-align: middle; border-radius: 3px; background-color: #fbe5e1; color: #c0341d; border-width: initial !important; border-style: none !important; border-color: initial !important;\">a\/+<\/code>\u5339\u914d<code style=\"margin-right: 3px; margin-left: 3px; padding-right: 5px; padding-left: 5px; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace, sans-serif; font-size: 12px; line-height: 1.8; display: inline-block; overflow-x: auto; vertical-align: middle; border-radius: 3px; background-color: #fbe5e1; color: #c0341d; border-width: initial !important; border-style: none !important; border-color: initial !important;\">a\/x<\/code>\u6216<code style=\"margin-right: 3px; margin-left: 3px; padding-right: 5px; padding-left: 5px; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace, sans-serif; font-size: 12px; line-height: 1.8; display: inline-block; overflow-x: auto; vertical-align: middle; border-radius: 3px; background-color: #fbe5e1; color: #c0341d; border-width: initial !important; border-style: none !important; border-color: initial !important;\">a\/y<\/code>\u30022. <code style=\"margin-right: 3px; margin-left: 3px; padding-right: 5px; padding-left: 5px; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace, sans-serif; font-size: 12px; line-height: 1.8; display: inline-block; overflow-x: auto; vertical-align: middle; border-radius: 3px; background-color: #fbe5e1; color: #c0341d; border-width: initial !important; border-style: none !important; border-color: initial !important;\">#<\/code>\uff1a\u8868\u793a\u591a\u5c42\u901a\u914d\u7b26\uff0c\u4f8b\u5982<code style=\"margin-right: 3px; margin-left: 3px; padding-right: 5px; padding-left: 5px; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace, sans-serif; font-size: 12px; line-height: 1.8; display: inline-block; overflow-x: auto; vertical-align: middle; border-radius: 3px; background-color: #fbe5e1; color: #c0341d; border-width: initial !important; border-style: none !important; border-color: initial !important;\">a\/#<\/code>\u5339\u914d<code style=\"margin-right: 3px; margin-left: 3px; padding-right: 5px; padding-left: 5px; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace, sans-serif; font-size: 12px; line-height: 1.8; display: inline-block; overflow-x: auto; vertical-align: middle; border-radius: 3px; background-color: #fbe5e1; color: #c0341d; border-width: initial !important; border-style: none !important; border-color: initial !important;\">a\/x<\/code>\u3001<code style=\"margin-right: 3px; margin-left: 3px; padding-right: 5px; padding-left: 5px; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace, sans-serif; font-size: 12px; line-height: 1.8; display: inline-block; overflow-x: auto; vertical-align: middle; border-radius: 3px; background-color: #fbe5e1; color: #c0341d; border-width: initial !important; border-style: none !important; border-color: initial !important;\">a\/b\/c\/d<\/code>\u3002<span style=\"color: #ff0000;\">\u3010\u6ce8\u610f\uff1a\u901a\u914d\u7b26\u4e3b\u9898\u53ea\u80fd\u7528\u4e8e\u8ba2\u9605\uff0c\u4e0d\u80fd\u7528\u4e8e\u53d1\u5e03\u3002\u3011<\/span><\/p>\n<p style=\"margin: 10px auto;\">QoS(Quality of Service):<\/p>\n<p style=\"margin: 10px auto;\">MQTT \u63d0\u4f9b\u4e86\u4e09\u79cd\u670d\u52a1\u8d28\u91cf\uff08QoS\uff09\uff0c\u5728\u4e0d\u540c\u7f51\u7edc\u73af\u5883\u4e0b\u4fdd\u8bc1\u6d88\u606f\u7684\u53ef\u9760\u6027\u3002<\/p>\n<ul class=\"list-paddingleft-1\" style=\"list-style-type: disc;\">\n<li>QoS 0\uff1a\u6d88\u606f\u6700\u591a\u4f20\u9001\u4e00\u6b21\u3002\u5982\u679c\u5f53\u524d\u5ba2\u6237\u7aef\u4e0d\u53ef\u7528\uff0c\u5b83\u5c06\u4e22\u5931\u8fd9\u6761\u6d88\u606f\u3002<\/li>\n<li>QoS 1\uff1a\u6d88\u606f\u81f3\u5c11\u4f20\u9001\u4e00\u6b21\u3002<\/li>\n<li>QoS 2\uff1a\u6d88\u606f\u53ea\u4f20\u9001\u4e00\u6b21\u3002<\/li>\n<\/ul>\n<p style=\"margin: 10px auto;\">\n<p style=\"margin: 10px auto;\"><strong>2.2 \u5de5\u4f5c\u6d41\u7a0b<\/strong><\/p>\n<ol class=\"list-paddingleft-1\" style=\"padding-left: 40px;\">\n<li style=\"margin-bottom: 1em; list-style: inherit;\">\u5ba2\u6237\u7aef\u4f7f\u7528 TCP\/IP \u534f\u8bae\u4e0e Broker \u5efa\u7acb\u8fde\u63a5\uff0c\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528 TLS\/SSL \u52a0\u5bc6\u6765\u5b9e\u73b0\u5b89\u5168\u901a\u4fe1\u3002\u5ba2\u6237\u7aef\u63d0\u4f9b\u8ba4\u8bc1\u4fe1\u606f\uff0c\u5e76\u6307\u5b9a\u4f1a\u8bdd\u7c7b\u578b\uff08Clean Session \u6216 Persistent Session\uff09\u3002<\/li>\n<li style=\"margin-bottom: 1em; list-style: inherit;\">\u5ba2\u6237\u7aef\u65e2\u53ef\u4ee5\u5411\u7279\u5b9a\u4e3b\u9898\u53d1\u5e03\u6d88\u606f\uff0c\u4e5f\u53ef\u4ee5\u8ba2\u9605\u4e3b\u9898\u4ee5\u63a5\u6536\u6d88\u606f\u3002\u5f53\u5ba2\u6237\u7aef\u53d1\u5e03\u6d88\u606f\u65f6\uff0c\u5b83\u4f1a\u5c06\u6d88\u606f\u53d1\u9001\u7ed9 MQTT Broker\uff1b\u800c\u5f53\u5ba2\u6237\u7aef\u8ba2\u9605\u6d88\u606f\u65f6\uff0c\u5b83\u4f1a\u63a5\u6536\u4e0e\u8ba2\u9605\u4e3b\u9898\u76f8\u5173\u7684\u6d88\u606f\u3002<\/li>\n<li style=\"margin-bottom: 1em; list-style: inherit;\">MQTT Broker \u63a5\u6536\u53d1\u5e03\u7684\u6d88\u606f\uff0c\u5e76\u5c06\u8fd9\u4e9b\u6d88\u606f\u8f6c\u53d1\u7ed9\u8ba2\u9605\u4e86\u5bf9\u5e94\u4e3b\u9898\u7684\u5ba2\u6237\u7aef\u3002\u5b83\u6839\u636e QoS \u7b49\u7ea7\u786e\u4fdd\u6d88\u606f\u53ef\u9760\u4f20\u9012\uff0c\u5e76\u6839\u636e\u4f1a\u8bdd\u7c7b\u578b\u4e3a\u65ad\u5f00\u8fde\u63a5\u7684\u5ba2\u6237\u7aef\u5b58\u50a8\u6d88\u606f\u3002<\/li>\n<\/ol>\n<p style=\"margin: 10px auto;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" style=\"max-width: 700px; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important; border: 0px initial initial;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223444785.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-imgfileid=\"100004385\" data-ratio=\"0.3755725190839695\" data-type=\"png\" data-w=\"655\" \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" style=\"max-width: 700px; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important; border: 0px initial initial;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223444785.png\" data-imgfileid=\"100004385\" data-ratio=\"0.3755725190839695\" data-type=\"png\" data-w=\"655\" \/><\/noscript><\/p>\n<p style=\"margin: 10px auto;\"><strong><span style=\"font-size: 16px;\">3.MQTT\u7b80\u5355\u4f7f\u7528<\/span><\/strong><\/p>\n<p style=\"margin: 10px auto;\">EMQX\u4f18\u52bf\u7684\u5730\u65b9\u5728\u4e8e\u63d0\u4f9b\u4e86Web\u5f62\u5f0f\u7684\u5ba2\u6237\u7aef\uff08MQTTX\uff09\u4ee5\u53ca\u5728\u7ebf\u8bd5\u7528\u7684Broker\uff0c\u8fd9\u5bf9\u4e8e\u5b66\u4e60MQTT\u7684\u670b\u53cb\u63d0\u4f9b\u4e86\u6781\u5927\u7684\u4fbf\u5229\u3002<\/p>\n<p style=\"margin: 10px auto;\">\u672c\u6587\u4f7f\u7528docker\u5f62\u5f0f\u90e8\u7f72\u672c\u5730\u7684emqx\u3002\u90e8\u7f72\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<ol class=\"list-paddingleft-1\" style=\"padding-left: 40px;\">\n<li style=\"margin-bottom: 1em; list-style: inherit;\">docker pull emqx\/emqx:5.1.6<\/li>\n<li style=\"margin-bottom: 1em; list-style: inherit;\">docker run -d --name emqx -p 1883:1883 -p 8083:8083 -p 8084:8084 -p 8883:8883 -p 18083:18083 emqx\/emqx:5.1.6<\/li>\n<li style=\"margin-bottom: 1em; list-style: inherit;\">\u6d4f\u89c8\u5668\u8f93\u5165\u4f60\u7684IP:18083\uff0c\u9ed8\u8ba4\u8d26\u6237\u5bc6\u7801\u4e3aadmin\/public\uff0c\u9996\u6b21\u767b\u5f55\u9700\u6539\u5bc6\u7801\u3002<\/li>\n<\/ol>\n<p style=\"margin: 10px auto;\">\u9875\u9762\u6253\u5f00\u7684\u662fEMQX \u63d0\u4f9b\u4e86\u4e00\u4e2a\u5185\u7f6e\u7684\u7ba1\u7406\u63a7\u5236\u53f0\uff0c\u5373 EMQX Dashboard\u3002\u65b9\u4fbf\u7528\u6237\u901a\u8fc7 Web \u9875\u9762\u5c31\u80fd\u8f7b\u677e\u7ba1\u7406\u548c\u76d1\u63a7 EMQX \u96c6\u7fa4\uff0c\u5e76\u914d\u7f6e\u548c\u4f7f\u7528\u6240\u9700\u7684\u5404\u9879\u529f\u80fd\u3002\u8fd9\u4e5f\u662fEMQX\u7684\u4f18\u52bf\u3002<\/p>\n<p style=\"margin: 10px auto;\">\u5728EMQX Dashboard\u4e2d\u8fdb\u5165\u5ba2\u6237\u7aef\u8ba4\u8bc1\u9875\u9762\uff0c\u6dfb\u52a0\u57fa\u4e8epassword_based\u65b9\u5f0f\u8ba4\u8bc1\u673a\u5236\uff0c\u6dfb\u52a0\u65f6\u4e5f\u53ef\u4ee5\u9009\u62e9\u5b58\u50a8\u8ba4\u8bc1\u4fe1\u606f\u7684\u6570\u636e\u6e90\uff0c\u4f7f\u7528\u975e\u5e38\u65b9\u4fbf\u3002\u3010\u53ef\u9009\u3011<\/p>\n<p style=\"margin: 10px auto;\">\u4e0b\u9762\u5df2Python\u5ba2\u6237\u7aef(paho-mqtt)\u4e3a\u4f8b\u6f14\u793a\u6570\u636e\u63a5\u6536\u4e0e\u53d1\u9001\uff0cBroker\u4f7f\u7528\u672c\u5730\u90e8\u7f72\u7684\uff0c\u5f53\u7136\u4e5f\u53ef\u5df2\u4f7f\u7528EMQX\u63d0\u4f9b\u7684\u8bd5\u7528Broker\u3002\u76f4\u63a5\u4e0a\u4ee3\u7801\u3002<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> random<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> time<\/span><\/code><code><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">from<\/span> paho.mqtt <span class=\"code-snippet__keyword\">import<\/span> client <span class=\"code-snippet__keyword\">as<\/span> mqtt_client<\/span><\/code><code><\/code><code><\/code><code><span class=\"code-snippet_outer\">broker = <span class=\"code-snippet__string\">'IP'<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">port = <span class=\"code-snippet__number\">8083<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">topic = <span class=\"code-snippet__string\">\"\/python\/mqtt\"<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">client_id = <span class=\"code-snippet__string\">f'python-mqtt-<span class=\"code-snippet__subst\">{random.randint(<span class=\"code-snippet__number\">0<\/span>, <span class=\"code-snippet__number\">1000<\/span>)}<\/span>'<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">username = <span class=\"code-snippet__string\">'\u8d26\u6237'<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">password = <span class=\"code-snippet__string\">'\u5bc6\u7801'<\/span><\/span><\/code><code><\/code><code><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">connect_mqtt<\/span><span class=\"code-snippet__params\">()<\/span> -&gt; mqtt_client:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">on_connect<\/span><span class=\"code-snippet__params\">(client, userdata, flags, rc)<\/span>:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">if<\/span> rc == <span class=\"code-snippet__number\">0<\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">            print(<span class=\"code-snippet__string\">\"Connected to MQTT Broker!\"<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">            print(<span class=\"code-snippet__string\">\"Failed to connect, return code %dn\"<\/span>, rc)<\/span><\/code><code><\/code><code><span class=\"code-snippet_outer\">    client = mqtt_client.Client(client_id, transport=<span class=\"code-snippet__string\">\"websockets\"<\/span>)  <span class=\"code-snippet__comment\"># \u4f7f\u7528websockets\u65b9\u5f0f\u8fde\u63a5\uff0c\u9ed8\u8ba4\u7aef\u53e38083<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    client.username_pw_set(username=username, password=password)<\/span><\/code><code><span class=\"code-snippet_outer\">    client.on_connect = on_connect<\/span><\/code><code><span class=\"code-snippet_outer\">    client.connect(host=broker, port=port)<\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__keyword\">return<\/span> client<\/span><\/code><code><\/code><code><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">publish<\/span><span class=\"code-snippet__params\">(client: mqtt_client)<\/span>:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    msg_count = <span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__keyword\">while<\/span> <span class=\"code-snippet__keyword\">True<\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">        time.sleep(<span class=\"code-snippet__number\">1<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\">        msg = <span class=\"code-snippet__string\">f\"messages: <span class=\"code-snippet__subst\">{msg_count}<\/span>\"<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">        result = client.publish(topic, msg)<\/span><\/code><code><span class=\"code-snippet_outer\">        status = result[<span class=\"code-snippet__number\">0<\/span>]<\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">if<\/span> status == <span class=\"code-snippet__number\">0<\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">            print(<span class=\"code-snippet__string\">f\"Send <span class=\"code-snippet__subst\">{msg}<\/span> to topic <span class=\"code-snippet__subst\">{topic}<\/span>\"<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">            print(<span class=\"code-snippet__string\">f\"Failed to send message to topic <span class=\"code-snippet__subst\">{topic}<\/span>\"<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\">        msg_count += <span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><\/code><code><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">run<\/span><span class=\"code-snippet__params\">()<\/span>:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    client = connect_mqtt()<\/span><\/code><code><span class=\"code-snippet_outer\">    client.loop_start()<\/span><\/code><code><span class=\"code-snippet_outer\">    publish(client)<\/span><\/code><\/pre>\n<\/section>\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> random<\/span><\/code><code><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">from<\/span> paho.mqtt <span class=\"code-snippet__keyword\">import<\/span> client <span class=\"code-snippet__keyword\">as<\/span> mqtt_client<\/span><\/code><code><\/code><code><span class=\"code-snippet_outer\">broker = <span class=\"code-snippet__string\">'IP'<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">port = <span class=\"code-snippet__number\">8083<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">topic = <span class=\"code-snippet__string\">\"\/python\/mqtt\"<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">client_id = <span class=\"code-snippet__string\">f'python-mqtt-<span class=\"code-snippet__subst\">{random.randint(<span class=\"code-snippet__number\">0<\/span>, <span class=\"code-snippet__number\">1000<\/span>)}<\/span>'<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">username = <span class=\"code-snippet__string\">'\u8d26\u6237'<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">password = <span class=\"code-snippet__string\">'\u5bc6\u7801'<\/span><\/span><\/code><code><\/code><code><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">connect_mqtt<\/span><span class=\"code-snippet__params\">()<\/span> -&gt; mqtt_client:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">on_connect<\/span><span class=\"code-snippet__params\">(client, userdata, flags, rc)<\/span>:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">if<\/span> rc == <span class=\"code-snippet__number\">0<\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">            print(<span class=\"code-snippet__string\">\"Connected to MQTT Broker!\"<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">            print(<span class=\"code-snippet__string\">\"Failed to connect, return code %dn\"<\/span>, rc)<\/span><\/code><code><\/code><code><span class=\"code-snippet_outer\">    client = mqtt_client.Client(client_id, transport=<span class=\"code-snippet__string\">\"websockets\"<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\">    client.username_pw_set(username=username, password=password)<\/span><\/code><code><span class=\"code-snippet_outer\">    client.on_connect = on_connect<\/span><\/code><code><span class=\"code-snippet_outer\">    client.connect(host=broker, port=port)<\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__keyword\">return<\/span> client<\/span><\/code><code><\/code><code><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">subscribe<\/span><span class=\"code-snippet__params\">(client: mqtt_client)<\/span>:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">on_message<\/span><span class=\"code-snippet__params\">(client, userdata, msg)<\/span>:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">        print(msg)<\/span><\/code><code><span class=\"code-snippet_outer\">        print(<span class=\"code-snippet__string\">f\"Received <span class=\"code-snippet__subst\">{msg.payload.decode()}<\/span> from <span class=\"code-snippet__subst\">{msg.topic}<\/span> topic\"<\/span>)<\/span><\/code><code><\/code><code><span class=\"code-snippet_outer\">    client.subscribe(topic)<\/span><\/code><code><span class=\"code-snippet_outer\">    client.on_message = on_message<\/span><\/code><code><\/code><code><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">run<\/span><span class=\"code-snippet__params\">()<\/span>:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    client = connect_mqtt()<\/span><\/code><code><span class=\"code-snippet_outer\">    subscribe(client)<\/span><\/code><code><span class=\"code-snippet_outer\">    client.loop_forever()<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 10px auto;\"><img loading=\"lazy\" decoding=\"async\" class=\"rich_pages wxw-img lazyload\" style=\"max-width: 700px; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important; border: 0px initial initial;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223448236.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" width=\"800\" height=\"260\" data-imgfileid=\"100004386\" data-ratio=\"0.4377104377104377\" data-type=\"png\" data-w=\"594\" \/><noscript><img loading=\"lazy\" decoding=\"async\" class=\"rich_pages wxw-img\" style=\"max-width: 700px; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important; border: 0px initial initial;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223448236.png\" width=\"800\" height=\"260\" data-imgfileid=\"100004386\" data-ratio=\"0.4377104377104377\" data-type=\"png\" data-w=\"594\" \/><\/noscript><\/p>\n<p style=\"margin: 10px auto;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" style=\"max-width: 700px; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important; border: 0px initial initial;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223451600.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-imgfileid=\"100004387\" data-ratio=\"0.3570536828963795\" data-type=\"png\" data-w=\"801\" \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" style=\"max-width: 700px; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important; border: 0px initial initial;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223451600.png\" data-imgfileid=\"100004387\" data-ratio=\"0.3570536828963795\" data-type=\"png\" data-w=\"801\" \/><\/noscript><\/p>\n<p style=\"margin: 10px auto;\">\u8fd0\u884c\u811a\u672c\u540e\u53ef\u4ee5\u5728\u63a7\u5236\u53f0\u770b\u5230\u5b9e\u65f6\u7684\u770b\u5230Broker\u7684\u4f7f\u7528\u60c5\u51b5\uff0c\u7b80\u76f4\u592a\u65b9\u4fbf\u4e86\u3002<\/p>\n<p style=\"margin: 10px auto;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" style=\"max-width: 700px; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important; border: 0px initial initial;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223456418.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-imgfileid=\"100004388\" data-ratio=\"0.19722222222222222\" data-type=\"png\" data-w=\"1080\" \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" style=\"max-width: 700px; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important; border: 0px initial initial;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223456418.png\" data-imgfileid=\"100004388\" data-ratio=\"0.19722222222222222\" data-type=\"png\" data-w=\"1080\" \/><\/noscript><\/p>\n<p style=\"margin: 10px auto;\"><strong><span style=\"font-size: 16px;\">4.MQTT\u8c03\u8bd5<\/span><\/strong><\/p>\n<p style=\"margin: 10px auto;\">EMQX\u63a7\u5236\u53f0\u4e2d\u6982\u89c8\u53ef\u4ee5\u770b\u5230\u5f53\u524d\u6570\u636e\u6d41\u5165\u5927\u5c0f\uff0c\u53ef\u4ee5\u6309\u65f6\u95f4\u6bb5\u7edf\u8ba1\u4e3b\u9898\u63a5\u6536\u6d88\u8d39\u6570\u636e\u91cf\uff0c\u4f46\u5982\u679c\u8981\u9488\u5bf9\u67d0\u4e2a\u4e3b\u9898\u8fdb\u884c\u6570\u636e\u6d41\u5165\u6d41\u51fa\u8c03\u8bd5\u65f6\u53ef\u4ee5\u4f7f\u7528\u4e3b\u9898\u76d1\u63a7\u8fd9\u4e2a\u529f\u80fd\uff0c\u5728\u4e3b\u9898\u76d1\u63a7\u4e0b\u53ef\u4ee5\u9488\u5bf9\u67d0\u4e2a\u4e3b\u9898\u67e5\u770b\u6d88\u606f\u6d41\u5165\u3001\u6d41\u51fa\u3001\u4e22\u5931\u7684\u6570\u503c\u3002<\/p>\n<p style=\"margin: 10px auto;\">\n<p style=\"margin: 10px auto;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" style=\"max-width: 700px; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important; border: 0px initial initial;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223500352.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-imgfileid=\"100004389\" data-ratio=\"0.24351851851851852\" data-type=\"png\" data-w=\"1080\" \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" style=\"max-width: 700px; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important; border: 0px initial initial;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223500352.png\" data-imgfileid=\"100004389\" data-ratio=\"0.24351851851851852\" data-type=\"png\" data-w=\"1080\" \/><\/noscript><\/p>\n<blockquote style=\"margin-top: 10px; margin-bottom: 10px; padding-top: 5px; padding-right: 10px; padding-bottom: 5px; background: none 25px 0px no-repeat; border-top: none; border-right: none; border-bottom: none; border-left-color: #e2dfdf; color: #333333; min-height: 35px; line-height: 1.6em;\">\n<p style=\"margin: 10px auto;\">\u5728\u53d1\u9001\u6d88\u606f\u65f6\uff0c\u5ba2\u6237\u7aefloop_start()\u540e\uff0c\u4f7f\u7528publish\u8fd4\u56de\u503c\u8fdb\u884c\u6d88\u606f\u53d1\u9001\u6210\u529f\u5931\u8d25\u4e0d\u662f\u5f88\u51c6\u786e\u3002\u8981\u4fdd\u8bc1\u6d88\u606f\u6210\u529f\u53d1\u9001\u5fc5\u987b\u5728publish\u8fd4\u56de\u503c\u540e\u5728\u8c03\u7528wait_for_publish()f\u65b9\u6cd5\uff0c\u4fdd\u8bc1\u6570\u636e\u767e\u5206\u767e\u53d1\u9001\u3002<\/p>\n<\/blockquote>\n<p style=\"display: none;\">\n<blockquote><p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7: \u8fd0\u7ef4\u8fdb\u9636\u90e8\u843d<\/p><\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>EMQ X\uff08\u7b80\u79f0 EMQ\uff09\uff0c \u662f\u4e00\u6b3e\u5b8c\u5168\u5f00\u6e90\uff0c\u9ad8\u5ea6\u53ef\u4f38\u7f29\uff0c\u9ad8\u53ef\u7528\u7684\u5206\u5e03\u5f0f MQTT \u6d88\u606f\u670d\u52a1\u5668\uff0c\u540c\u65f6\u4e5f\u652f\u6301 CoAP\/LwM2M  &#8230;<\/p>\n","protected":false},"author":1,"featured_media":6028,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[7],"tags":[],"class_list":["post-6045","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring-boot"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223432497-150x150.jpeg","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223440660.png","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223432497-300x127.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223432497.jpeg","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223440660.png","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223432497-300x127.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223432497.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223432497.jpeg","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223440660.png","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223440660.png","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223444785.png","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223444785.png","id":"image3"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223448236.png","id":"image4"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223448236.png","id":"image5"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223451600.png","id":"image6"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223451600.png","id":"image7"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223456418.png","id":"image8"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223456418.png","id":"image9"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223500352.png","id":"image10"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223500352.png","id":"image11"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring Boot","post_date":"2024-08-01","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":287,"next_post_id":5896,"next_post_title":"Spring Cloud Gateway \u5b9e\u73b0\u6570\u5b57\u7b7e\u540d\u4e0e URL \u52a8\u6001\u52a0\u5bc6","previous_post_id":5997,"previous_post_title":"SpringBoot\u5b9e\u73b0\u5206\u5e03\u5f0f\u9a8c\u8bc1\u7801\u767b\u5f55\u65b9\u6848","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/6045","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=6045"}],"version-history":[{"count":2,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/6045\/revisions"}],"predecessor-version":[{"id":6456,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/6045\/revisions\/6456"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/6028"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=6045"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=6045"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=6045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}