Documentation ¶
Index ¶
- type Conn
- type Error
- type WebSocket
- func (handle *WebSocket) Listen(writer http.ResponseWriter, request *http.Request, responseHeader http.Header)
- func (handle *WebSocket) SetCloseHandle(fun func(id string, err error)) *WebSocket
- func (handle *WebSocket) SetConnectHandle(fun func(id string, ws *Conn)) *WebSocket
- func (handle *WebSocket) SetErrorHandle(fun func(id string, err error)) *WebSocket
- func (handle *WebSocket) SetId(id string) *WebSocket
- func (handle *WebSocket) SetOnMessageHandle(fun func(id string, ws *Conn, messageType int, data []byte)) *WebSocket
- type WebSocketConnections
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WebSocket ¶
type WebSocket struct { Id string OnError func(id string, err error) OnConnect func(id string, ws *Conn) OnClose func(id string, err error) OnMessage func(id string, ws *Conn, messageType int, data []byte) }
WebSocket 执行
func (*WebSocket) SetCloseHandle ¶
func (*WebSocket) SetConnectHandle ¶
func (*WebSocket) SetErrorHandle ¶
type WebSocketConnections ¶
type WebSocketConnections struct {
// contains filtered or unexported fields
}
WebSocketConnections ws连接用户
func NewWebSocketConnections ¶
func NewWebSocketConnections() *WebSocketConnections
NewWebSocketConnections 单例
func (*WebSocketConnections) Delete ¶
func (connections *WebSocketConnections) Delete(key string) bool
Delete 删除长连接对象
func (*WebSocketConnections) Get ¶
func (connections *WebSocketConnections) Get(key string) *Conn
Get 获取长连接对象
func (*WebSocketConnections) GetAll ¶
func (connections *WebSocketConnections) GetAll() map[string]*Conn
GetAll 获取所有长连接对象
func (*WebSocketConnections) Set ¶
func (connections *WebSocketConnections) Set(key string, conn *Conn)
Set 设置长连接对象
Click to show internal directories.
Click to hide internal directories.