Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message is the data produced by the websocket.
type Options ¶
type Options struct { PingInterval time.Duration ResetInterval time.Duration // PoolSize defines the size of the pool of pre-allocated buffers for storing data // received from the websocket connection. If not set, it will be set to 32 by // default. PoolSize int // BufCapacity sets the initial capacity of buffers in the websocket's buffer pool. // You should set this to be larger than the typical size of a message from the // specific websocket connection to reduce the number of memory allocations. If not // set, it will be set to 2048 bytes by default. BufCapacity int }
type Websocket ¶
type Websocket struct { Url string OnConnect func() error ResetInterval time.Duration PingInterval time.Duration // contains filtered or unexported fields }
Websocket handles a websocket client connection to a given URL.
func (*Websocket) Close ¶
func (ws *Websocket) Close()
Close sends a closes the websocket connection. The Messages channel will be closed immediately after.
func (*Websocket) Messages ¶
Messages returns a channel containing the messages received from the websocket. Each Message received should be released back to the websocket's buffer pool by calling Release once you are finished with the message.
Click to show internal directories.
Click to hide internal directories.