Documentation ¶
Index ¶
- Variables
- type Client
- func (wsc *Client) Disconnect()
- func (wsc *Client) OnWSUpgrade(ctx context.Context, conn *websocket.Conn, rawMsgChan chan *RawMsg)
- func (wsc *Client) RawMsgSend(msg *RawMsg)
- func (wsc *Client) RawMsgSendNonBlock(msg *RawMsg)
- func (wsc *Client) ReadWorker(fnLog log.FnT, traceID string, cb ReaderCb)
- func (wsc *Client) TextMsgSend(text []byte)
- func (wsc *Client) TextMsgSendWithDone(text []byte, done chan error)
- func (wsc *Client) WriteWorker(fnLog log.FnT, traceID string, enablePing bool, ...)
- type RawMsg
- type ReaderCb
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrChanIsFull = errors.New("chan is full")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Disconnect ¶
func (wsc *Client) Disconnect()
Disconnect cancel ctx. y d better cancel parent context in order to disconnect.
func (*Client) OnWSUpgrade ¶
OnWSUpgrade should be triggered whe websocket upgraded.
func (*Client) RawMsgSendNonBlock ¶
RawMsgSendNonBlock sends msg and do not block.
func (*Client) ReadWorker ¶
ReadWorker handles all reads operations for websocket connection.
prefix => log-prefix.
func (*Client) TextMsgSend ¶
TextMsgSend sends text message.
func (*Client) TextMsgSendWithDone ¶
TextMsgSendWithDone sends text message with done send chan.
func (*Client) WriteWorker ¶
func (wsc *Client) WriteWorker(fnLog log.FnT, traceID string, enablePing bool, pingPeriod, writeTimeout time.Duration, enablePongHandler bool, readTimeout time.Duration, )
WriteWorker handles all writes operations for websocket connection. Some ws endpoints don't support ping/pong. enablePing == false. pingPeriod, writeTimeout are useless. enablePongHandler == false. readTimeout is useless.
Click to show internal directories.
Click to hide internal directories.