Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitWebSocket ¶
func InitWebSocket(pathExp string, handlerFunc HandlerReadFunc, stateFunc HandlerStateFunc, timeOut time.Duration, isMult bool) *rest.Route
websocket 初始化接口
pathExp 域, handlerFunc 读到的消息回调 stateFunc 连接消息回调 timeOut 读取超时回调(0则永不超时) isMult 是否多用户登录
Types ¶
type ClientBody ¶
type ClientBody struct { Code int `json:"code,omitempty"` Data interface{} `json:"data,omitempty"` }
type HandlerReadFunc ¶
type HandlerReadFunc func(string, string, ClientBody, *websocket.Conn) //ID , MESSAGEID,内容
type HandlerStateFunc ¶
type HandlerStateFunc func(string, string, WSMessageType) //状态发声改变回调
type WSMessageType ¶
type WSMessageType uint8
const ( WS_Login WSMessageType = 1 // 链接 WS_Close WSMessageType = 2 // 断线 )
Click to show internal directories.
Click to hide internal directories.