<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>bati11</author_name>
  <author_url>https://blog.hatena.ne.jp/bati11/</author_url>
  <blog_title>bati11 の 日記</blog_title>
  <blog_url>https://blog.bati11.info/</blog_url>
  <categories>
    <anon>Go</anon>
    <anon>MQTT</anon>
  </categories>
  <description>前回、別goroutineで発生したエラーハンドリングをしました。具体的にはサブスクライバへの書き込みでエラーが発生した場合にサブスクリプションの削除処理するようにしました。今回は、 context.Context を使ってgoroutineを停止することで、クライアントが接続を切ったタイミングでサブスクリプションの削除をするようにしてみます。 目次。 今のgoroutine goroutineリーク contextパッケージ おしまい 今のgoroutine 現状の実装だと、クライアントからSUBSCRIBEパケットが送信されてくると、いくつかのgoroutineが生成され以下のような親子関…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.bati11.info%2Fentry%2F2019%2F05%2F12%2F204358&quot; title=&quot;MQTTサーバーを実装しながらGoを学ぶ - その１２ Contextを使ったgoroutineの停止 - bati11 の 日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://i.gyazo.com/6bf617a5406e91b099915ce86e0aff09.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-05-12 20:43:58</published>
  <title>MQTTサーバーを実装しながらGoを学ぶ - その１２ Contextを使ったgoroutineの停止</title>
  <type>rich</type>
  <url>https://blog.bati11.info/entry/2019/05/12/204358</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
