code: func (c *wsConn) writePump() {
  	ticker := time.NewTicker(pingPeriod)
  	defer func() {
  		ticker.Stop()
  		c.ws.Close()
  	}()
  	for {
  		select {
  		case message, ok := <-c.send:
  			if !ok {
  				c.write(websocket.CloseMessage, []byte{})
  				return
  			}
  			if err := c.write(websocket.TextMessage, message); err != nil {
  				return
  			}
  		case <-ticker.C:
  			if err := c.write(websocket.PingMessage, []byte{}); err != nil {
  				return
  			}
  		}
  	}
  }
docs: // writePump pumps messages from the hub to the websocket connection.