title: How to access other client connections from a Go WebSocket handler?
body: <p><em>Note: I'm more interested in understanding general Go concepts/patterns, rather than solving this contrived example.</em></p>
  
  <p>The Go (golang) WebSocket package provides a trivial <a href="http://golang.org/pkg/websocket/#Handler" rel="nofollow noreferrer">echo server example</a>, which condenses down to something like this:</p>
  
  <pre><code>func EchoServer(ws *websocket.Conn) { io.Copy(ws, ws); }
  
  func main() {
   http.Handle("/echo", websocket.Handler(EchoServer));
   http.ListenAndServe(":12345", nil);
  }
  </code></pre>
  
  <p>The server handles simultaneous connections, and I'm trying to upgrade it to a basic chat server by echoing the input to all connected clients.</p>
  
  <p>How would I go about providing the EchoServer handler access to each of the open connections?</p>