func (cc *ChatClient) Start() {
	req := &websocket.Request{
		Method: http.MethodPost,
		Target: "/message",
	}
	reader := bufio.NewReader(os.Stdin)
	for {
		fmt.Print(cc.user.Name + "> ")
		req.Body, _ = reader.ReadString('\n')
		req.Body = strings.TrimSpace(req.Body)
		if len(req.Body) == 0 {
			continue
		}
		req.ID = uint64(time.Now().Unix())
		packet, err := json.Marshal(req)
		if err != nil {
			log.Fatal(err)
		}
		err = cc.conn.SendText(packet)
		if err != nil {
			log.Fatal(err.Error())
		}
	}
}
Start the chat client.
package main
import (
	"bufio"
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"os"
	"strconv"
	"strings"
	"time"
	"github.com/shuLhan/share/lib/websocket"
	"github.com/shuLhan/share/lib/websocket/examples"
)
type ChatClient struct {
	user *examples.Account
	conn *websocket.Client
}
func NewChatClient(user *examples.Account) (cc *ChatClient) {
	cc = &ChatClient{
		user: user,
		conn: &websocket.Client{
			Endpoint: "ws://127.0.0.1:9001",
			Headers: http.Header{
				"Key": []string{user.Key},
			},
		},
	}
	cc.conn.HandleText = cc.handleText
	cc.conn.HandleQuit = func() {
		log.Println("connection has been closed...")
		os.Exit(0)
	}
	err := cc.conn.Connect()
	if err != nil {
		log.Fatal("Connect: " + err.Error())
	}
	log.Printf("%s: connected ...", user.Name)
	return cc
}