func (c *Client) Listen() {
	go c.listenWrite()
	c.listenRead()
}
Listen Write and Read request via chanel
package chat
import (
	"fmt"
	"io"
	"log"
	"golang.org/x/net/websocket"
)
const channelBufSize = 100
var maxId int = 0
type Client struct {
	id     int
	ws     *websocket.Conn
	server *Server
	ch     chan *Message
	doneCh chan bool
}
func NewClient(ws *websocket.Conn, server *Server) *Client {
	if ws == nil {
		panic("ws cannot be nil")
	}
	if server == nil {
		panic("server cannot be nil")
	}
	maxId++
	ch := make(chan *Message, channelBufSize)
	doneCh := make(chan bool)
	return &Client{maxId, ws, server, ch, doneCh}
}
func (c *Client) Conn() *websocket.Conn {
	return c.ws
}
func (c *Client) Write(msg *Message) {
	select {
	case c.ch <- msg:
	default:
		c.server.Del(c)
		err := fmt.Print("client %d is disconnected.")
		c.server.Err(err)
	}
}
func (c *Client) Done() {
	c.doneCh <- true
}