README ¶ gowsclient golang 使用 gorilla/websocket 封装client,使得websocket客户端更易用,更强壮。 这是对websocket的轻量级封装,解决一些典型问题。包含keepalive,autoReconnect,loop read message,write message串行化。以及onConnected onReceive 事件的封装,使用方法见client_test.go. Expand ▾ Collapse ▴ Documentation ¶ Index ¶ type Client func New(rawUrl string) (*Client, error) func NewWithHeader(rawUrl string, header *http.Header) (*Client, error) func (c *Client) Close() func (c *Client) Connect() func (c *Client) WriteMessage(msg *Message) type Message Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type Client ¶ type Client struct { OnConnect func() OnReceive func(msg *Message) // contains filtered or unexported fields } func New ¶ func New(rawUrl string) (*Client, error) func NewWithHeader ¶ func NewWithHeader(rawUrl string, header *http.Header) (*Client, error) func (*Client) Close ¶ func (c *Client) Close() func (*Client) Connect ¶ func (c *Client) Connect() func (*Client) WriteMessage ¶ func (c *Client) WriteMessage(msg *Message) type Message ¶ type Message struct { Mt int Message []byte } Source Files ¶ View all Source files client.go Click to show internal directories. Click to hide internal directories.