Documentation ¶
Index ¶
- Constants
- Variables
- func NewServer(addr string, needSecret bool) *server
- type ClientConn
- func (this *ClientConn) Addr() string
- func (this *ClientConn) Close()
- func (this *ClientConn) GetProperty(key string) (interface{}, error)
- func (this *ClientConn) Push(name string, data interface{})
- func (this *ClientConn) RemoveProperty(key string)
- func (this *ClientConn) Send(name string, data interface{}) *RspBody
- func (this *ClientConn) SetOnClose(hookFunc func(*ClientConn))
- func (this *ClientConn) SetOnPush(hookFunc func(*ClientConn, *RspBody))
- func (this *ClientConn) SetProperty(key string, value interface{})
- func (this *ClientConn) Start() bool
- type Group
- type HandlerFunc
- type Handshake
- type Heartbeat
- type Mgr
- func (this *Mgr) Count() int
- func (this *Mgr) NewConn(wsSocket *websocket.Conn, needSecret bool) *ServerConn
- func (this *Mgr) Push(pushSync conn.PushSync)
- func (this *Mgr) PushByRoleId(rid int, msgName string, data interface{}) bool
- func (this *Mgr) RemoveConn(conn WSConn)
- func (this *Mgr) RoleEnter(conn WSConn, rid int)
- func (this *Mgr) UserLogin(conn WSConn, session string, uid int)
- func (this *Mgr) UserLogout(conn WSConn)
- type MiddlewareFunc
- type ProxyClient
- func (this *ProxyClient) Close()
- func (this *ProxyClient) Connect() error
- func (this *ProxyClient) Send(msgName string, msg interface{}) (*RspBody, error)
- func (this *ProxyClient) SetOnClose(hookFunc func(*ClientConn))
- func (this *ProxyClient) SetOnPush(hookFunc func(*ClientConn, *RspBody))
- func (this *ProxyClient) SetProperty(key string, value interface{})
- type ReqBody
- type Router
- type RspBody
- type ServerConn
- func (this *ServerConn) Addr() string
- func (this *ServerConn) Close()
- func (this *ServerConn) GetProperty(key string) (interface{}, error)
- func (this *ServerConn) Handshake()
- func (this *ServerConn) Push(name string, data interface{})
- func (this *ServerConn) RemoveProperty(key string)
- func (this *ServerConn) Send(name string, data interface{})
- func (this *ServerConn) SetOnBeforeClose(hookFunc func(WSConn))
- func (this *ServerConn) SetOnClose(hookFunc func(WSConn))
- func (this *ServerConn) SetProperty(key string, value interface{})
- func (this *ServerConn) SetRouter(router *Router)
- func (this *ServerConn) Start()
- type WSConn
- type WsMsgReq
- type WsMsgRsp
Constants ¶
View Source
const HandshakeMsg = "handshake"
View Source
const HeartbeatMsg = "heartbeat"
Variables ¶
View Source
var ConnMgr = Mgr{}
Functions ¶
Types ¶
type ClientConn ¶
type ClientConn struct { Seq int64 // contains filtered or unexported fields }
客户端连接
func NewClientConn ¶
func NewClientConn(wsSocket *websocket.Conn) *ClientConn
func (*ClientConn) Addr ¶
func (this *ClientConn) Addr() string
func (*ClientConn) Close ¶
func (this *ClientConn) Close()
func (*ClientConn) GetProperty ¶
func (this *ClientConn) GetProperty(key string) (interface{}, error)
获取链接属性
func (*ClientConn) Push ¶
func (this *ClientConn) Push(name string, data interface{})
func (*ClientConn) Send ¶
func (this *ClientConn) Send(name string, data interface{}) *RspBody
func (*ClientConn) SetOnClose ¶
func (this *ClientConn) SetOnClose(hookFunc func(*ClientConn))
func (*ClientConn) SetOnPush ¶
func (this *ClientConn) SetOnPush(hookFunc func(*ClientConn, *RspBody))
func (*ClientConn) SetProperty ¶
func (this *ClientConn) SetProperty(key string, value interface{})
设置链接属性
func (*ClientConn) Start ¶
func (this *ClientConn) Start() bool
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func (*Group) AddRouter ¶
func (this *Group) AddRouter(name string, handlerFunc HandlerFunc, middleware ...MiddlewareFunc)
func (*Group) Use ¶
func (this *Group) Use(middleware ...MiddlewareFunc) *Group
type HandlerFunc ¶
type Mgr ¶
type Mgr struct {
// contains filtered or unexported fields
}
func (*Mgr) NewConn ¶
func (this *Mgr) NewConn(wsSocket *websocket.Conn, needSecret bool) *ServerConn
func (*Mgr) PushByRoleId ¶
func (*Mgr) RemoveConn ¶
func (*Mgr) UserLogout ¶
type MiddlewareFunc ¶
type MiddlewareFunc func(HandlerFunc) HandlerFunc
type ProxyClient ¶
type ProxyClient struct {
// contains filtered or unexported fields
}
func NewProxyClient ¶
func NewProxyClient(proxy string) *ProxyClient
func (*ProxyClient) Close ¶
func (this *ProxyClient) Close()
func (*ProxyClient) Connect ¶
func (this *ProxyClient) Connect() error
func (*ProxyClient) Send ¶
func (this *ProxyClient) Send(msgName string, msg interface{}) (*RspBody, error)
func (*ProxyClient) SetOnClose ¶
func (this *ProxyClient) SetOnClose(hookFunc func(*ClientConn))
func (*ProxyClient) SetOnPush ¶
func (this *ProxyClient) SetOnPush(hookFunc func(*ClientConn, *RspBody))
func (*ProxyClient) SetProperty ¶
func (this *ProxyClient) SetProperty(key string, value interface{})
type ServerConn ¶
type ServerConn struct { Seq int64 // contains filtered or unexported fields }
客户端连接
func NewServerConn ¶
func NewServerConn(wsSocket *websocket.Conn, needSecret bool) *ServerConn
func (*ServerConn) Addr ¶
func (this *ServerConn) Addr() string
func (*ServerConn) Close ¶
func (this *ServerConn) Close()
func (*ServerConn) GetProperty ¶
func (this *ServerConn) GetProperty(key string) (interface{}, error)
获取链接属性
func (*ServerConn) Push ¶
func (this *ServerConn) Push(name string, data interface{})
func (*ServerConn) Send ¶
func (this *ServerConn) Send(name string, data interface{})
func (*ServerConn) SetOnBeforeClose ¶
func (this *ServerConn) SetOnBeforeClose(hookFunc func(WSConn))
func (*ServerConn) SetOnClose ¶
func (this *ServerConn) SetOnClose(hookFunc func(WSConn))
func (*ServerConn) SetProperty ¶
func (this *ServerConn) SetProperty(key string, value interface{})
设置链接属性
func (*ServerConn) SetRouter ¶
func (this *ServerConn) SetRouter(router *Router)
Click to show internal directories.
Click to hide internal directories.