Documentation ¶
Index ¶
Constants ¶
View Source
const ( TextMessage = 1 BinaryMessage = 2 CloseMessage = 8 PingMessage = 9 PongMessage = 10 )
declare message types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Close closes the connection. // It's safe to call multiple times. Close() // OnClose is called when the // connection is closed. OnClose(func()) // OnMessageRecv is called when a // message is received. It must be // a non-blocking function. OnMessageRecv(func(int, []byte)) // Write a message to the client. Write(int, []byte) }
WebSocket client.
type ClientConfig ¶
type ClientConfig struct { // writeTimeout is the timeout // to close the connection if // message not writed. WriteTimeout time.Duration // pingInterval is the interval // between each ping. If value // is <= 0 the server will not // send ping messages. PingInterval time.Duration // maxMessageLength is the max // number of bytes in a client // message. Connection will be // closed if exceeded. MaxMessageLength int }
Click to show internal directories.
Click to hide internal directories.