Documentation ¶
Index ¶
- type DeliveryTaskFunc
- type EventHandleFunc
- type EventHandler
- type Room
- type RpcHandleFunc
- type RpcHandler
- type Server
- func (s *Server) HttpHandler() http.Handler
- func (s *Server) RegisterEventHandler(mp map[string]EventHandler)
- func (s *Server) RegisterRpcHandler(mp map[string]RpcHandler)
- func (s *Server) RegisterTaskHandler(taskName string, handler func(data interface{})) DeliveryTaskFunc
- func (s *Server) RemoveSession(id SessionId)
- func (s *Server) RoomByName(name string) *Room
- func (s *Server) RoomExist(name string) bool
- func (s *Server) SessionById(id SessionId) (ss *Session, ok bool)
- type Session
- type SessionId
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeliveryTaskFunc ¶
type EventHandleFunc ¶
type EventHandleFunc func(ss *Session, data interface{})
func (EventHandleFunc) HandleEvent ¶
func (fn EventHandleFunc) HandleEvent(ss *Session, data interface{})
type EventHandler ¶
type EventHandler interface {
HandleEvent(ss *Session, data interface{})
}
type RpcHandleFunc ¶
func (RpcHandleFunc) HandleRpc ¶
func (fn RpcHandleFunc) HandleRpc(ss *Session, p gson) (result interface{}, err error)
type RpcHandler ¶
type Server ¶
type Server struct { SessionKeepTime time.Duration // 断线, 回话维持时间 KeepMessageCount int // 断线保留的消息数量 BeforeAcceptSession func(ss *Session) (err error) AfterAcceptSession func(ss *Session) (err error) BeforeDispatchUserEvent func(ss *Session, event string) (err error) BeforeDispatchUserRpc func(ss *Session, method string) (err error) OnSessionLost func(ss *Session) // contains filtered or unexported fields }
func (*Server) RegisterEventHandler ¶
func (s *Server) RegisterEventHandler(mp map[string]EventHandler)
func (*Server) RegisterRpcHandler ¶
func (s *Server) RegisterRpcHandler(mp map[string]RpcHandler)
func (*Server) RegisterTaskHandler ¶
func (s *Server) RegisterTaskHandler(taskName string, handler func(data interface{})) DeliveryTaskFunc
func (*Server) RemoveSession ¶
func (*Server) RoomByName ¶
Click to show internal directories.
Click to hide internal directories.