{"id":338040,"date":"2022-09-07T09:00:37","date_gmt":"2022-09-07T09:00:37","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=338040"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=338040","title":{"rendered":"<span>\u041e\u0434\u0438\u043d \u0438\u0437 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u0432\u0435\u0449\u0435\u0439 \u2014 CoAP<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/38\/17\/kx\/3817kxwllnegbtus8vfi1svgshe.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/38\/17\/kx\/3817kxwllnegbtus8vfi1svgshe.jpeg\" data-blurred=\"true\"\/><br \/>  <i><font color=\"#858585\"><a href=\"https:\/\/www.freepik.com\/free-vector\/internet-things-iot-smart-connection-control-device-network-industry-resident-anywhere-anytime-anybody-any-business-with-internet-it-technology-futuristic-world_25326178.htm#query=iot%20device%20management&amp;position=3&amp;from_view=search\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/a><\/font><\/i><\/p>\n<p>  \u0413\u043e\u0432\u043e\u0440\u044f \u043e\u0431 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0432\u0435\u0449\u0435\u0439, \u043c\u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u0441\u0432\u044f\u0437\u043a\u0430 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0438\u043b\u0438 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0451\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0435\u0441\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430 \u2014 Mqtt broker.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0432\u0435\u0449\u0435\u0439 \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c, \u0438 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0434\u0440\u0443\u0433\u043e\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 \u2014 CoAP.<a name=\"habracut\"><\/a><\/p>\n<h2><font color=\"#076184\">\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432<\/font><\/h2>\n<p>  \u041d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u043d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 \u0438 \u0438\u0445 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/5y\/dk\/s-\/5ydks-b2w98jmccd5ihlz7hecd0.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/5y\/dk\/s-\/5ydks-b2w98jmccd5ihlz7hecd0.jpeg\" data-blurred=\"true\"\/><\/p>\n<h3><font color=\"#163C51\">Mqtt<\/font><\/h3>\n<p>  \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e \u0447\u0442\u043e \u043e\u0431\u0430 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 IoT, \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f, \u043a\u0430\u0441\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043a\u0430\u043a \u043b\u043e\u0433\u0438\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b, \u0442\u0430\u043a \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041f\u043e\u0434 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e, \u043f\u043e \u0441\u0443\u0442\u0438, \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u044b, \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e\u0449\u0438\u0435 \u043d\u0435\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u044b, \u0447\u0438\u0442\u0430\u044e\u0449\u0438\u0435 \u044d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u043c\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0431\u0440\u043e\u043a\u0435\u0440.<\/p>\n<p>  \u041e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043f\u0438\u043a\u0430\u043c\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043f\u0438\u043a, \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b.<\/p>\n<p>  \u041f\u0440\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u0435\u043a\u043e\u0439 \u043d\u043e\u0432\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u043d\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0432 \u0442\u043e\u043f\u0438\u043a\u0435, \u0438 \u044d\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0440\u0430\u0437\u0443 \u0432\u0438\u0434\u044f\u0442 \u0432\u0441\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043d\u0435\u0433\u043e.<\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u043f\u0438\u043a\u043e\u0432 \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043a\u0440\u0451\u0441\u0442\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u0413\u043e\u0432\u043e\u0440\u044f \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0437\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438.<\/p>\n<h3><font color=\"#163C51\">CoAP<\/font><\/h3>\n<p>  \u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0431\u044b\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 \u0432 2014 \u0433\u043e\u0434\u0443.<\/p>\n<p>  \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 Mqtt, \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b CoAP \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0443\u0437\u043b\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043b\u043e\u0433\u0438\u043a\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\/\u043a\u043b\u0438\u0435\u043d\u0442: \u0437\u0434\u0435\u0441\u044c, \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c, \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0441\u0432\u043e\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443, \u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043a \u0442\u043e\u043c \u0430\u0434\u0440\u0435\u0441\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 HTTP-\u043c\u0435\u0442\u043e\u0434\u043e\u0432:<\/p>\n<ul>\n<li>GET (\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441);<\/li>\n<li>POST (\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441);<\/li>\n<li>PUT (\u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441);<\/li>\n<li>DELETE ( \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441).<\/li>\n<\/ul>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 REST, \u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043e\u0431\u044b\u0447\u043d\u043e\u043c\u0443 \u0432\u0435\u0431-\u0440\u0435\u0441\u0443\u0440\u0441\u0443, \u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0436\u0435 \u043d\u0435 \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c.<\/p>\n<p>  \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 http.<\/p>\n<p>  \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0447\u0435\u0442\u044b\u0440\u0435 \u0442\u0438\u043f\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>CON \u2014 \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (\u0437\u0430\u043f\u0440\u043e\u0441\/\u043e\u0442\u0432\u0435\u0442) \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u043d\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0438;<\/li>\n<li>ACK \u2014 \u043e\u0442\u0432\u0435\u0442\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 CON;<\/li>\n<li>NON \u2014 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (\u0437\u0430\u043f\u0440\u043e\u0441\/\u043e\u0442\u0432\u0435\u0442), \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0435\u0435 \u043e\u0442\u0432\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f;<\/li>\n<li>RST \u2014 \u0441\u0431\u0440\u043e\u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (Reset). \u0422\u0430\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0442\u0432\u0435\u0442, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u043b\u0438 \u0435\u0451 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044c. \u0412 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0438\u043d\u0433\u043e\u0432\u0430\u0442\u044c \u0443\u0437\u0435\u043b, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044f \u043d\u0430 \u0443\u0437\u0435\u043b \u043f\u0443\u0441\u0442\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 CON.<\/li>\n<\/ul>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"http:\/\/lib.tssonline.ru\/articles2\/internet-of-things\/protokol-interneta-veschey-coap\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  \u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0432 \u0433\u0440\u0443\u043f\u043f\u044b, \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u041e\u0431\u043c\u0435\u043d \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p>  \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0435\u0441\u0442\u044c \u0432 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0438 \u0438\u0445 \u0444\u043e\u0440\u043c\u0430\u0442.<\/p>\n<p>  CoAP \u0431\u044b\u043b \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0451\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0440\u044f\u0434\u043a\u0430 10 \u041a\u0411 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 100 \u041a\u0411 \u043f\u043e\u0434 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0443.<\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043a\u0440\u043e\u043c\u043d\u044b\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0435\u0433\u043e \u0440\u0430\u043c\u043a\u0430\u0445 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u044b \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b UDP \u043f\u043e\u0432\u0435\u0440\u0445 IP.<\/p>\n<p>  \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438, \u043d\u043e \u0438 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0441\u043b\u0430\u0431\u044b\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0438 \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u044b\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 \u0431\u0430\u0437\u0435 java \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u043b\u0438 \u041f\u041a, \u043a\u0430\u043a <a href=\"https:\/\/www.eclipse.org\/californium\/\">Californium<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/github.com\/eclipse\/leshan\">Leshan<\/a> \u2014 \u043d\u0430\u0434\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0430\u0434 Californium.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432, \u0442\u043e \u0434\u043b\u044f \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0439 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c Mqtt (\u0442\u0430\u043c, \u0433\u0434\u0435 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e), \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f (QoS), \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0443 \u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430 \u0431\u0440\u043e\u043a\u0435\u0440\u0435. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, CoAP \u0445\u043e\u0440\u043e\u0448 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432, \u0430 QoS \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0436\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/hirotakaster\/CoAP-simple-library\">CoAP-simple-library<\/a>.<\/p>\n<p>  \u041e\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0440\u044f\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u0441\u0440\u0435\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\/\u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430 \u0431\u0430\u0437\u0435 esp32:<\/p>\n<hr\/>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 esp32<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/* Copyright (c) 2022 Hirotaka Niisato This software is released under the MIT License.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and\/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *\/  #include &lt;WiFi.h> #include &lt;WiFiUdp.h> #include &lt;coap-simple.h>  const char* ssid     = \"your-ssid\"; const char* password = \"your-password\";  \/\/ CoAP client response callback void callback_response(CoapPacket &amp;packet, IPAddress ip, int port);  \/\/ CoAP server endpoint url callback void callback_light(CoapPacket &amp;packet, IPAddress ip, int port);  \/\/ UDP and CoAP class \/\/ other initialize is \"Coap coap(Udp, 512);\" \/\/ 2nd default parameter is COAP_BUF_MAX_SIZE(defaulit:128) \/\/ For UDP fragmentation, it is good to set the maximum under \/\/ 1280byte when using the internet connection. WiFiUDP udp; Coap coap(udp);  \/\/ LED STATE bool LEDSTATE;  \/\/ CoAP server endpoint URL void callback_light(CoapPacket &amp;packet, IPAddress ip, int port) {   Serial.println(\"[Light] ON\/OFF\");      \/\/ send response   char p[packet.payloadlen + 1];   memcpy(p, packet.payload, packet.payloadlen);   p[packet.payloadlen] = NULL;      String message(p);    if (message.equals(\"0\"))     LEDSTATE = false;   else if(message.equals(\"1\"))     LEDSTATE = true;          if (LEDSTATE) {     digitalWrite(9, HIGH) ;      coap.sendResponse(ip, port, packet.messageid, \"1\");   } else {      digitalWrite(9, LOW) ;      coap.sendResponse(ip, port, packet.messageid, \"0\");   } }  \/\/ CoAP client response callback void callback_response(CoapPacket &amp;packet, IPAddress ip, int port) {   Serial.println(\"[Coap Response got]\");      char p[packet.payloadlen + 1];   memcpy(p, packet.payload, packet.payloadlen);   p[packet.payloadlen] = NULL;      Serial.println(p); }  void setup() {   Serial.begin(9600);    WiFi.begin(ssid, password);   while (WiFi.status() != WL_CONNECTED) {       delay(500);       Serial.print(\".\");   }    Serial.println(\"\");   Serial.println(\"WiFi connected\");   Serial.println(\"IP address: \");   Serial.println(WiFi.localIP());    \/\/ LED State   pinMode(9, OUTPUT);   digitalWrite(9, HIGH);   LEDSTATE = true;      \/\/ add server url endpoints.   \/\/ can add multiple endpoint urls.   \/\/ exp) coap.server(callback_switch, \"switch\");   \/\/      coap.server(callback_env, \"env\/temp\");   \/\/      coap.server(callback_env, \"env\/humidity\");   Serial.println(\"Setup Callback Light\");   coap.server(callback_light, \"light\");    \/\/ client response callback.   \/\/ this endpoint is single callback.   Serial.println(\"Setup Response Callback\");   coap.response(callback_response);    \/\/ start coap server\/client   coap.start(); }  void loop() {   delay(1000);   coap.loop(); } \/* if you change LED, req\/res test with coap-client(libcoap), run following. coap-client -m get coap:\/\/(arduino ip addr)\/light coap-client -e \"1\" -m put coap:\/\/(arduino ip addr)\/light coap-client -e \"0\" -m put coap:\/\/(arduino ip addr)\/light *\/<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<hr\/>\n<p>  \u041a\u0430\u043a \u0437\u0430\u044f\u0432\u043b\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u0440 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0435\u0449\u0451 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c (\u0442.\u043a. \u043a\u043e\u0434 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442) \u043d\u0430 \u0431\u0430\u0437\u0435 <a href=\"https:\/\/github.com\/1248\/microcoap\">microcoap<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/libcoap.net\/\">lipcoap<\/a> \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>  \u041e\u0434\u0438\u043d \u0438\u0437 \u0442\u0435\u0441\u0442\u0435\u0440\u043e\u0432 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043d\u0430\u043b\u0430\u0434\u0438\u0442\u044c \u043d\u0430 \u0435\u0451 \u0431\u0430\u0437\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c \u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c, \u043e\u0434\u043d\u0430\u043a\u043e \u043e\u043d \u043e\u0442\u043c\u0435\u0442\u0438\u043b \u043d\u0435\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e \u0441\u0430\u043c\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 (\u043d\u0430 \u0435\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434) \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043e\u0434\u043d\u0430\u043a\u043e \u043e\u043d \u043e\u043f\u0438\u0441\u0430\u043b \u0441\u0432\u043e\u0439 \u043e\u043f\u044b\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f <a href=\"https:\/\/programming.vip\/docs\/coap-protocol-arduino-esp32-m2m-end-to-end-communication-and-code-explanation.html\">\u0434\u0432\u0443\u0445 esp32 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439<\/a>.<\/p>\n<p>  \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u044d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0447\u0438\u0441\u0442\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u044b\u0448\u0435 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u0430\u043b\u043e\u0440\u0435\u0441\u0443\u0440\u0441\u043d\u044b\u0445 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c esp32 \u044f\u0432\u043d\u043e \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f.<\/p>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c, \u0441 \u043c\u043e\u0435\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f, \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/Alv3s\/Thing.CoAP\">Thing.CoAP<\/a>, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0438 \u0431\u044b\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043a\u0430\u043a \u043d\u0430 \u0431\u0430\u0437\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c Windows \u0438 Linux, \u0442\u0430\u043a \u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 ESP32 \u0438 ESP8266.<\/p>\n<p>  \u041a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u0430\u044f \u0431\u0430\u0437\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u0430\u043a \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u0442\u0430\u043a \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>  \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0445 \u043e\u0431\u043e\u0438\u0445, \u0442\u043e, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, <i>\u00ab\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u044d\u0442\u043e \u0437\u0434\u0435\u0441\u044c\u00bb<\/i>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/yp\/px\/gm\/yppxgmhb8liwe3muuexwl0mpuia.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/yp\/px\/gm\/yppxgmhb8liwe3muuexwl0mpuia.jpeg\" data-blurred=\"true\"\/><\/p>\n<p>  \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438 \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, esp32 (\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e), \u0447\u0442\u043e \u0434\u0430\u0451\u0442 \u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439, \u0442\u0430\u043a \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043a\u043e\u0434\u0435 \u043d\u0438\u0436\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043b\u0438\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e sendMessage(), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0448\u043b\u0451\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 GET, \u0441\u0440\u0430\u0437\u0443 \u0432\u044b\u0432\u043e\u0434\u044f \u043e\u0442\u0432\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre><code class=\"cpp\">void sendMessage(){   \/\/Make a post   coapClient.Get(\"create1\", \"\", [](Thing::CoAP::Response response){       std::vector&lt;uint8_t> payload = response.GetPayload();       std::string received(payload.begin(), payload.end());       Serial.println(\"Server sent the following message:\");       Serial.println(received.c_str());       delay(5000);       sendMessage();   }); }<\/code><\/pre>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/* MIT License  Copyright (c) 2020 Alv3s  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and\/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *\/  #include &lt;WiFi.h>  \/\/Include Thing.CoAP #include \"Thing.CoAP.h\"  \/\/[RECOMMENDED] Alternatively, if you are NOT using Arduino IDE \/\/you can include each file you need as bellow:  \/\/#include \"Thing.CoAP\/Client.h\" \/\/#include \"Thing.CoAP\/ESP\/UDPPacketProvider.h\"  \/\/Declare our CoAP client and the packet handler Thing::CoAP::Client coapClient; Thing::CoAP::ESP::UDPPacketProvider udpProvider;  \/\/Change here your WiFi settings char* ssid = \"YourWiFiSSID\"; char* password = \"YourWiFiPassword\";  void sendMessage(){   \/\/Make a post   coapClient.Get(\"create1\", \"\", [](Thing::CoAP::Response response){       std::vector&lt;uint8_t> payload = response.GetPayload();       std::string received(payload.begin(), payload.end());       Serial.println(\"Server sent the following message:\");       Serial.println(received.c_str());       delay(5000);       sendMessage();   }); }  void setup() {   \/\/Initializing the Serial   Serial.begin(115200);   Serial.println(\"Initializing\");      \/\/Try and wait until a connection to WiFi was made   WiFi.begin(ssid, password);   while (WiFi.status() != WL_CONNECTED) {     delay(1000);     Serial.println(\"Connecting to WiFi..\");   }   Serial.println(\"Connected to the WiFi network\");   Serial.println(\"My IP: \");   Serial.println(WiFi.localIP());    \/\/Configure our server to use our packet handler (It will use UDP)   coapClient.SetPacketProvider(udpProvider);   IPAddress ip(104, 196, 15, 150);    \/\/Connect CoAP client to a server   coapClient.Start(ip, 5683);      \/\/Send A Message   sendMessage(); }  void loop() {   coapClient.Process(); }<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<hr\/>\n<p>  \u0410 \u043d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0443\u0436\u0435 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440. \u0425\u043e\u0440\u043e\u0448\u043e \u0432\u0438\u0434\u043d\u043e, \u043a\u0430\u043a \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435:<\/p>\n<hr\/>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/* MIT License  Copyright (c) 2020 Alv3s  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and\/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *\/  #include &lt;WiFi.h>  \/\/Include Thing.CoAP #include \"Thing.CoAP.h\"  \/\/[RECOMMENDED] Alternatively, if you are NOT using Arduino IDE \/\/you can include each file you need as bellow:  \/\/#include \"Thing.CoAP\/Client.h\" \/\/#include \"Thing.CoAP\/ESP\/UDPPacketProvider.h\" \/\/#include \"Thing.CoAP\/WebLink.h\"  \/\/Declare our CoAP client and the packet handler Thing::CoAP::Client coapClient; Thing::CoAP::ESP::UDPPacketProvider udpProvider;  \/\/Change here your WiFi settings char* ssid = \"YourWiFiSSID\"; char* password = \"YourWiFiPassword\";  void setup() {  \/\/Initializing the Serial  Serial.begin(115200);  Serial.println(\"Initializing\");   \/\/Try and wait until a connection to WiFi was made  WiFi.begin(ssid, password);  while (WiFi.status() != WL_CONNECTED) {   delay(1000);   Serial.println(\"Connecting to WiFi..\");  }  Serial.println(\"Connected to the WiFi network\");  Serial.println(\"My IP: \");  Serial.println(WiFi.localIP());   \/\/Configure our server to use our packet handler (It will use UDP)  coapClient.SetPacketProvider(udpProvider);  IPAddress ip(104, 196, 15, 150);   \/\/Connect CoAP client to a server  coapClient.Start(ip, 5683);    \/\/Make the discovery  coapClient.Discover([](Thing::CoAP::Response&amp; response) {   std::vector&lt;uint8_t> payload = response.GetPayload();   std::string received(payload.begin(), payload.end());    \/\/Parse the response to weblinks   std::list&lt;Thing::CoAP::WebLink> links = Thing::CoAP::WebLink::ParseString(received);   for (auto&amp; link : links)   {    \/\/Print the URI of the resource    Serial.println(link.GetURI().c_str());        \/\/Prints if the resource is observable or not    Serial.print(\"\\t\");    Serial.print(\"Observable: \");    Serial.println((link.IsObservable() ? \" Yes\" : \"No\"));        \/\/Prints the content format of the resource    Serial.print(\"\\t\");    Serial.print(\"Content Format: \");    switch (link.GetContentFormat())    { case Thing::CoAP::ContentFormat::ApplicationEXI: Serial.println(\"ApplicationEXI\"); break; case Thing::CoAP::ContentFormat::ApplicationJSon: Serial.println(\"ApplicationJSon\"); break; case Thing::CoAP::ContentFormat::ApplicationLinkFormat: Serial.println(\"ApplicationLinkFormat\"); break; case Thing::CoAP::ContentFormat::ApplicationOctetStream: Serial.println(\"ApplicationOctetStream\"); break; case Thing::CoAP::ContentFormat::ApplicationXML: Serial.println(\"ApplicationXML\"); break; case Thing::CoAP::ContentFormat::TextPlain: Serial.println(\"TextPlain\"); break;    }        \/\/If the link has title, print the title    if (link.HasTitle())    {     Serial.print(\"\\t\");     Serial.print(\"Title: \");     Serial.println(link.GetTitle().c_str());    }        \/\/If the link has Interface Description, print the Interface Description    if (link.HasInterfaceDescription())    {     Serial.print(\"\\t\");     Serial.print(\"Interface Description: \");     Serial.println(link.GetInterfaceDescription().c_str());    }        \/\/If the link has Maximum Size Estimate, print the Maximum Size Estimate    if (link.HasMaximumSizeEstimate())    {     Serial.print(\"\\t\");     Serial.print(\"Maximum Size Estimate: \");     Serial.println(link.GetMaximumSizeEstimate());    }        \/\/If the link has Resource Type, print the Resource Type    if (link.HasResourceType())    {     Serial.print(\"\\t\");     Serial.print(\"Resource Type: \");     Serial.println(link.GetResourceType().c_str());    }   }  }); }  void loop() {   coapClient.Process(); }<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<hr\/>\n<p>  \u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043a\u043e\u0434 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043d\u0430\u0431\u0436\u0451\u043d \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u043c\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438, \u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u0438\u0434\u043d\u043e, \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u00ab\u0440\u0430\u0441\u0448\u0430\u0440\u0438\u0432\u0430\u043d\u0438\u0435\u00bb \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 LED \u0438 BUTTON:<\/p>\n<pre><code class=\"cpp\">   \/\/\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \"LED\"   \/\/\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 true - \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0440\u0435\u0441\u0443\u0440\u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f   server.CreateResource(\"LED\", Thing::CoAP::ContentFormat::TextPlain, true)    \/\/\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \"Button\"   server.CreateResource(\"Button\", Thing::CoAP::ContentFormat::TextPlain, false) <\/code><\/pre>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/* MIT License  Copyright (c) 2020 Alv3s  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and\/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *\/  #include &lt;WiFi.h>  \/\/Include Thing.CoAP #include \"Thing.CoAP.h\"  \/\/[RECOMMENDED] Alternatively, if you are NOT using Arduino IDE \/\/you can include each file you need as bellow:  \/\/#include \"Thing.CoAP\/Server.h\" \/\/#include \"Thing.CoAP\/ESP\/UDPPacketProvider.h\"  \/\/Declare our CoAP server and the packet handler Thing::CoAP::Server server; Thing::CoAP::ESP::UDPPacketProvider udpProvider;  \/\/Change here your WiFi settings char* ssid = \"YourWiFiSSID\"; char* password = \"YourWiFiPassword\";  #define LED 2 #define BUTTON 0  void setup() {   \/\/Initializing the Serial   Serial.begin(115200);   Serial.println(\"Initializing\");    \/\/Configure the LED as output   pinMode(LED, OUTPUT);   \/\/Configure Button   pinMode(BUTTON, INPUT_PULLUP);      \/\/Try and wait until a connection to WiFi was made   WiFi.begin(ssid, password);   while (WiFi.status() != WL_CONNECTED) {     delay(1000);     Serial.println(\"Connecting to WiFi..\");   }   Serial.println(\"Connected to the WiFi network\");   Serial.println(\"My IP: \");   Serial.println(WiFi.localIP());    \/\/Configure our server to use our packet handler (It will use UDP)   server.SetPacketProvider(udpProvider);    \/\/Create an resource called \"LED\"   \/\/True means that this resource is observable   server.CreateResource(\"LED\", Thing::CoAP::ContentFormat::TextPlain, true)       \/\/We are here configuring telling our server that,     \/\/when we receive a \"GET\" request to this endpoint,     \/\/run the the following code     .OnGet([](Thing::CoAP::Request &amp; request) {        Serial.println(\"GET Request received for endpoint 'LED'\");        \/\/Read the state of our led.       std::string result;       if(digitalRead(LED) == HIGH)         result = \"On\";       else         result = \"Off\";         \/\/Return the current state of our \"LED\".       return Thing::CoAP::Status::Content(result);       \/\/We are here configuring telling our server that,     \/\/when we receive a \"POST\" request to this endpoint,     \/\/run the the following code     }).OnPost([](Thing::CoAP::Request&amp; request) {         Serial.println(\"POST Request received for endpoint 'LED'\");        \/\/Get the message sent fromthe client and parse it to a string             auto payload = request.GetPayload();       std::string message(payload.begin(), payload.end());              Serial.print(\"The client sent the message: \");       Serial.println(message.c_str());        \/\/If the message is \"On\" we will turn the LED on.       if(message == \"On\") {          digitalWrite(LED, HIGH);        \/\/If it is \"Off\" we will turn the LED off.            } else if (message == \"Off\") {         digitalWrite(LED, LOW);        \/\/In case any other message is received       \/\/we will respond a \"BadRequest\" error.            } else {         return Thing::CoAP::Status::BadRequest();       }        \/\/In case \"On\" or \"Off\" was received, we will return \"Ok\"       \/\/with a message saying \"Command Executed\".       return Thing::CoAP::Status::Content(\"Command Executed\");     });    \/\/Create an resource called \"Button\"   server.CreateResource(\"Button\", Thing::CoAP::ContentFormat::TextPlain, false)           \/\/We are here configuring telling our server that,     \/\/when we receive a \"GET\" request to this endpoint,     \/\/run the the following code         .OnGet([](Thing::CoAP::Request &amp; request) {       Serial.println(\"GET Request received for endpoint 'Button'\");        \/\/Read the state of our led.       std::string result;       if(digitalRead(BUTTON) == HIGH)         result = \"On\";       else         result = \"Off\";         \/\/Return the current state of our \"LED\".       return Thing::CoAP::Status::Content(result);     });      server.Start(); }  void loop() {   server.Process(); }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<h2><font color=\"#076184\">\u0418\u0442\u043e\u0433<\/font><\/h2>\n<p>  \u0412 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u043c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u043b\u0430\u0431\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445, \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0441\u0435\u0442\u0438.<\/p>\n<p>  \u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 DTLS, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u043c 3072-\u0431\u0438\u0442\u043d\u043e\u043c\u0443 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044e RSA.<\/p>\n<p>  \u041d\u0430 \u0441\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, <a href=\"http:\/\/coap.technology\/impls.html\">\u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439<\/a>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043a\u0430\u043a \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445, \u0442\u0430\u043a \u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0447\u0435\u0440\u0435\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432.<\/p>\n<p>  \u041f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 Mqtt, \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u0434\u043b\u044f \u0440\u044f\u0434\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0431\u0440\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043b\u0430\u0433 (\u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0437-\u0437\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430, \u0438\u043b\u0438 \u0436\u0435, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u0442\u0430\u043a\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0439, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c.<\/p>\n<p>  \u041e\u0431\u0430 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430, \u0438 Mqtt, \u0438 CoAP, \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u043e\u0442 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u044d\u043d\u0435\u0440\u0433\u0438\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u0432\u0432\u0438\u0434\u0443 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e CoAP \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432 \u0441\u0432\u043e\u0435\u0439 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b UDP, \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u043d\u0430 \u0435\u0433\u043e \u0431\u0430\u0437\u0435, \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0432\u0435\u0440\u0436\u0435\u043d\u0430 \u043f\u043e\u0442\u0435\u0440\u044f\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0432\u0435\u0441 Mqtt, \u0433\u0434\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e QoS (Quality of Service) \u043c\u043e\u0436\u043d\u043e \u0432 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0438\u0445 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<hr\/>\n<p>\u041d\u041b\u041e \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u043e \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043b\u043e\u0433\u0430:<\/p>\n<p>   \u2014 <a href=\"https:\/\/firstvds.ru\/?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=product&amp;utm_content=vds15exeptprogrev\">15% \u043d\u0430 \u0432\u0441\u0435 \u0442\u0430\u0440\u0438\u0444\u044b VDS<\/a> (\u043a\u0440\u043e\u043c\u0435 \u0442\u0430\u0440\u0438\u0444\u0430 \u041f\u0440\u043e\u0433\u0440\u0435\u0432) \u2014 <b><font color=\"#163C51\">HABRFIRSTVDS<\/font><\/b>.<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/first\/blog\/685184\/\"> https:\/\/habr.com\/ru\/company\/first\/blog\/685184\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/38\/17\/kx\/3817kxwllnegbtus8vfi1svgshe.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/38\/17\/kx\/3817kxwllnegbtus8vfi1svgshe.jpeg\" data-blurred=\"true\"\/><br \/>  <i><font color=\"#858585\"><a href=\"https:\/\/www.freepik.com\/free-vector\/internet-things-iot-smart-connection-control-device-network-industry-resident-anywhere-anytime-anybody-any-business-with-internet-it-technology-futuristic-world_25326178.htm#query=iot%20device%20management&amp;position=3&amp;from_view=search\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/a><\/font><\/i><\/p>\n<p>  \u0413\u043e\u0432\u043e\u0440\u044f \u043e\u0431 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0432\u0435\u0449\u0435\u0439, \u043c\u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u0441\u0432\u044f\u0437\u043a\u0430 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0438\u043b\u0438 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0451\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0435\u0441\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430 \u2014 Mqtt broker.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0432\u0435\u0449\u0435\u0439 \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c, \u0438 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0434\u0440\u0443\u0433\u043e\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 \u2014 CoAP.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-338040","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=338040"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338040\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338040"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338040"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}