Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientBody ¶
type ClientBody struct { Code int `json:"code,omitempty"` Data interface{} `json:"data,omitempty"` }
type HandlerReadFunc ¶
type MyWebSocket ¶
type MyWebSocket struct {
// contains filtered or unexported fields
}
func NewWebSocket ¶
func NewWebSocket(url string, handlerFunc HandlerReadFunc, requestHeader http.Header, timeOut time.Duration) (*MyWebSocket, error)
websocket 初始化接口
addr 地址, path 域 handlerFunc 读到的消息回调 stateFunc 连接消息回调 timeOut 读取超时回调(0则永不超时)
func (*MyWebSocket) Close ¶
func (wss *MyWebSocket) Close()
func (*MyWebSocket) SendMessage ¶
func (wss *MyWebSocket) SendMessage(messageType int, p []byte) error
type WSMessageType ¶
type WSMessageType uint8
const ( WS_Login WSMessageType = 1 // 链接 WS_Close WSMessageType = 2 // 断线 )
Click to show internal directories.
Click to hide internal directories.