{"categories":["Go","MQTT"],"url":"https://blog.bati11.info/entry/2019/05/06/224639","blog_url":"https://blog.bati11.info/","image_url":"https://images-fe.ssl-images-amazon.com/images/I/51pUKQajnaL._SL160_.jpg","published":"2019-05-06 22:46:39","title":"MQTT\u30b5\u30fc\u30d0\u30fc\u3092\u5b9f\u88c5\u3057\u306a\u304c\u3089Go\u3092\u5b66\u3076 - \u305d\u306e\uff11\uff11 goroutine\u306e\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0, map, goroutine\u30bb\u30fc\u30d5","type":"rich","blog_title":"bati11 \u306e \u65e5\u8a18","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.bati11.info%2Fentry%2F2019%2F05%2F06%2F224639\" title=\"MQTT\u30b5\u30fc\u30d0\u30fc\u3092\u5b9f\u88c5\u3057\u306a\u304c\u3089Go\u3092\u5b66\u3076 - \u305d\u306e\uff11\uff11 goroutine\u306e\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0, map, goroutine\u30bb\u30fc\u30d5 - bati11 \u306e \u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","height":"190","width":"100%","author_url":"https://blog.hatena.ne.jp/bati11/","provider_name":"Hatena Blog","provider_url":"https://hatena.blog","version":"1.0","description":"\u524d\u56de\u306e\u7d9a\u304d\u3002\u5225\u306egoroutine\u3067\u767a\u751f\u3057\u305f\u30a8\u30e9\u30fc\u3092error channel\u3092\u4f7f\u3063\u3066\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u306e\u51e6\u7406\u3067map\u3092\u4f7f\u3063\u305f\u306e\u3067\u3059\u304c\u3001goroutine\u30bb\u30fc\u30d5\u306b\u3059\u308b\u305f\u3081 sync.Map \u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u3002 \u76ee\u6b21\u3002 handleSub \u3067\u30a8\u30e9\u30fc \u5225goroutine\u3092\u53d7\u3051\u53d6\u308berror channel \u30b5\u30d6\u30b9\u30af\u30ea\u30d7\u30b7\u30e7\u30f3\u306e\u7279\u5b9a MQTT\u306eClient ID map sync.Mutex sync.Map \u52d5\u304b\u3059 \u304a\u3057\u307e\u3044 handleSub \u3067\u30a8\u30e9\u30fc handleSub \u95a2\u6570\u3067\u30b5\u30d6\u30b9\u30af\u30e9\u30a4\u30d0\u306b\u5bfe\u3057\u3066PUBLISH\u3092\u9001\u3063\u3066\u3044\u308b\u3002 func handleSub(con\u2026","author_name":"bati11"}