title: Gorilla Websocket example hangs when trying to send data to a channel whilst handling another channel?
body: <p>I was following the chat client/server example for the gorilla websocket library.</p>
  <p><a href="https://github.com/gorilla/websocket/blob/master/examples/chat/hub.go#L36" rel="nofollow noreferrer">https://github.com/gorilla/websocket/blob/master/examples/chat/hub.go#L36</a></p>
  <p>I tried modifying the code to notify other clients when a new client connects, like so:</p>
  <pre><code>    for {
          select {
          case client := &lt;-h.register:
              h.clients[client] = true
  
              // My addition. Hangs after this (no further register/unregister events are processed):
              h.broadcast &lt;- []byte(&quot;Another client connected!&quot;)
          case client := &lt;-h.unregister:
              if _, ok := h.clients[client]; ok {
                  delete(h.clients, client)
                  close(client.send)
              }
          case message := &lt;-h.broadcast:
              for client := range h.clients {
                  select {
                  case client.send &lt;- message:
                  default:
                      close(client.send)
                      delete(h.clients, client)
                  }
              }
          }
      }
  }
  </code></pre>
  <p>My understanding is on the next iteration of the outer <code>for</code> loop, the broadcast channel should receive that data and follow the logic in the <code>message</code> case, but it just hangs.</p>
  <p>Why? I can't spot any reason. No further channel events are processed (nothing on register/unregister or broadcast), which makes me think it's some kind of unbuffered channel mechanism it's stuck on, but I don't see how?</p>