Documentation ¶
Index ¶
- Variables
- type WebSocketClient
- type WebSocketPool
- func (r *WebSocketPool) Close()
- func (r *WebSocketPool) Handle(condition func() (string, bool))
- func (WebSocketPool) Once(c *gin.Context) *WebSocketPool
- func (r *WebSocketPool) RegisterRouter(routerKey string, fn func(ws *websocket.Conn)) *WebSocketPool
- func (r *WebSocketPool) SendMessageByAccountOpenId(accountOpenId string, message []byte) error
- func (WebSocketPool) SendMessageByWsConn(ws *websocket.Conn, message []byte) error
- func (r WebSocketPool) SendMessageByWsManyConn(wsList []*websocket.Conn, message []byte)
- func (WebSocketPool) SetOnCloseConnectionErr(onCloseConnectionErr func(conn *websocket.Conn, err error)) *WebSocketPool
- func (WebSocketPool) SetOnConnect(onConnect func(*websocket.Conn)) *WebSocketPool
- func (WebSocketPool) SetOnConnectionErr(onConnectionErr func(error)) *WebSocketPool
- func (WebSocketPool) SetOnMessage(onMessage func(*websocket.Conn, []byte) string) *WebSocketPool
- func (WebSocketPool) SetOnMessageErr(onMessageErr func(*websocket.Conn, error)) *WebSocketPool
- func (WebSocketPool) SetOnRouterErr(onRouterErr func(*websocket.Conn, error)) *WebSocketPool
- func (WebSocketPool) SetOnSendMessageErr(onSendMessageErr func(conn *websocket.Conn, err error)) *WebSocketPool
Constants ¶
This section is empty.
Variables ¶
View Source
var ( WebSocketPoolApp WebSocketPool WebSocketClientApp WebSocketClient )
Functions ¶
This section is empty.
Types ¶
type WebSocketClient ¶
WebSocketClient websocket客户端
type WebSocketPool ¶
type WebSocketPool struct {
// contains filtered or unexported fields
}
WebSocketPool websocket连接池
func (*WebSocketPool) Handle ¶
func (r *WebSocketPool) Handle(condition func() (string, bool))
Handle 消息处理
func (WebSocketPool) Once ¶
func (WebSocketPool) Once(c *gin.Context) *WebSocketPool
Once 单例化:WebSocket连接池
func (*WebSocketPool) RegisterRouter ¶
func (r *WebSocketPool) RegisterRouter(routerKey string, fn func(ws *websocket.Conn)) *WebSocketPool
RegisterRouter 注册路由
func (*WebSocketPool) SendMessageByAccountOpenId ¶
func (r *WebSocketPool) SendMessageByAccountOpenId(accountOpenId string, message []byte) error
SendMessageByAccountOpenId 根据用户openId发送消息
func (WebSocketPool) SendMessageByWsConn ¶
func (WebSocketPool) SendMessageByWsConn(ws *websocket.Conn, message []byte) error
SendMessageByWsConn 通过链接发送消息
func (WebSocketPool) SendMessageByWsManyConn ¶
func (r WebSocketPool) SendMessageByWsManyConn(wsList []*websocket.Conn, message []byte)
SendMessageByWsManyConn 通过链接切片发送消息
func (WebSocketPool) SetOnCloseConnectionErr ¶
func (WebSocketPool) SetOnCloseConnectionErr(onCloseConnectionErr func(conn *websocket.Conn, err error)) *WebSocketPool
SetOnCloseConnectionErr 设置关闭链接错误回调
func (WebSocketPool) SetOnConnect ¶
func (WebSocketPool) SetOnConnect(onConnect func(*websocket.Conn)) *WebSocketPool
SetOnConnect 设置链接成功后回调
func (WebSocketPool) SetOnConnectionErr ¶
func (WebSocketPool) SetOnConnectionErr(onConnectionErr func(error)) *WebSocketPool
SetOnConnectionErr 设置链接失败后回调
func (WebSocketPool) SetOnMessage ¶
func (WebSocketPool) SetOnMessage(onMessage func(*websocket.Conn, []byte) string) *WebSocketPool
SetOnMessage 设置接收消息回调
func (WebSocketPool) SetOnMessageErr ¶
func (WebSocketPool) SetOnMessageErr(onMessageErr func(*websocket.Conn, error)) *WebSocketPool
SetOnMessageErr 设置接收消息失败回调
func (WebSocketPool) SetOnRouterErr ¶
func (WebSocketPool) SetOnRouterErr(onRouterErr func(*websocket.Conn, error)) *WebSocketPool
SetOnRouterErr 路由失败回调
func (WebSocketPool) SetOnSendMessageErr ¶
func (WebSocketPool) SetOnSendMessageErr(onSendMessageErr func(conn *websocket.Conn, err error)) *WebSocketPool
SetOnSendMessageErr 设置发送消息失败回调
Click to show internal directories.
Click to hide internal directories.