Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func KeepaliveMessage ¶
func KeepaliveMessage() []byte
func KeepaliveNull ¶
func KeepaliveNull() []byte
Types ¶
type Client ¶
type Client struct { Options *ClientOptions //request 请求上下文 Ctx IRequest // contains filtered or unexported fields }
func NewClient ¶
func NewClient(conf *gofkConfs.WsConfig, conn *websocket.Conn, handle IMsgHandler, opts ...ClientOption) *Client
type ClientOption ¶
type ClientOption func(options *ClientOptions)
type ClientOptions ¶
type ClientOptions struct {
// contains filtered or unexported fields
}
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func (*Hub) RegisterAdd ¶
func (*Hub) SessionLength ¶
func (*Hub) UnRegister ¶
type IMsgHandler ¶
type IRequest ¶
type IRequest interface { Message() event.IMessage SetMessage(message event.IMessage) Router() IMsgHandler Conn() *websocket.Conn }
func NewRequest ¶
func NewRequest(opts ...RequestOptionFunc) IRequest
type MsgHandler ¶
func NewMsgHandler ¶
func NewMsgHandler() *MsgHandler
func (*MsgHandler) AddRouter ¶
func (m *MsgHandler) AddRouter(method string, router IRouter)
AddRouter 2.添加路由器,为消息添加具体的处理业务逻辑
func (*MsgHandler) DoMsgHandler ¶
func (m *MsgHandler) DoMsgHandler(request IRequest) IResponse
DoMsgHandler 1.调度执行路由器,调度/执行对应的Router消息处理方法
type RequestOptionFunc ¶
type RequestOptionFunc func(options *requestOptions)
func WithHandler ¶
func WithHandler(handler IMsgHandler) RequestOptionFunc
func WithMessage ¶
func WithMessage(msg event.IMessage) RequestOptionFunc
func WithWsConnect ¶
func WithWsConnect(conn *websocket.Conn) RequestOptionFunc
Click to show internal directories.
Click to hide internal directories.