Documentation
¶
Index ¶
- type BaseSession
- func (b *BaseSession) GetSid() uint64
- func (b *BaseSession) HandleRoute(r *router.Router, m *deal.Msg) error
- func (b *BaseSession) Notice(route string, input interface{}) error
- func (b *BaseSession) Push(route string, input interface{}) error
- func (b *BaseSession) PushTo(sid uint64, route string, input interface{}) error
- func (b *BaseSession) Response(route string, input interface{}) error
- func (b *BaseSession) Rpc(route string, input, output interface{}) error
- func (b *BaseSession) RpcResponse(route string, input interface{}) error
- func (b *BaseSession) SendTo(addr string, msg *deal.Msg) error
- func (b *BaseSession) SetSid(sid uint64)
- type MasterSession
- type Member
- type MemberSession
- type ServerSession
- func (s *ServerSession) HandleRoute(r *router.Router, m *deal.Msg) error
- func (s *ServerSession) Notice(route string, input interface{}) error
- func (s *ServerSession) Push(route string, input interface{}) error
- func (s *ServerSession) PushTo(sid uint64, route string, input interface{}) error
- func (s *ServerSession) Response(route string, input interface{}) error
- func (s *ServerSession) Rpc(route string, input, output interface{}) error
- func (s *ServerSession) RpcResponse(route string, input interface{}) error
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseSession ¶
func GetBaseSession ¶
func GetBaseSession(h *core.TcpHandle) *BaseSession
func (*BaseSession) GetSid ¶
func (b *BaseSession) GetSid() uint64
func (*BaseSession) HandleRoute ¶
func (*BaseSession) Notice ¶
func (b *BaseSession) Notice(route string, input interface{}) error
func (*BaseSession) Push ¶
func (b *BaseSession) Push(route string, input interface{}) error
func (*BaseSession) PushTo ¶
func (b *BaseSession) PushTo(sid uint64, route string, input interface{}) error
func (*BaseSession) Response ¶
func (b *BaseSession) Response(route string, input interface{}) error
func (*BaseSession) Rpc ¶
func (b *BaseSession) Rpc(route string, input, output interface{}) error
func (*BaseSession) RpcResponse ¶
func (b *BaseSession) RpcResponse(route string, input interface{}) error
func (*BaseSession) SetSid ¶
func (b *BaseSession) SetSid(sid uint64)
type MasterSession ¶
type MasterSession struct {
*BaseSession
}
func GetMasterSession ¶
func GetMasterSession(h *core.TcpHandle) *MasterSession
func (*MasterSession) HandleRoute ¶
type Member ¶
type Member struct { sync.RWMutex // session集合 Sessions map[uint64]*MemberSession // 当前SID SID uint64 }
用于管理member的session
func (*Member) SessionFindByID ¶
func (m *Member) SessionFindByID(sid uint64) *MemberSession
session find
type MemberSession ¶
type MemberSession struct {
*BaseSession
}
member session
func GetMemberSession ¶
func GetMemberSession(h *core.TcpHandle) *MemberSession
func (*MemberSession) HandleRoute ¶
func (*MemberSession) Notice ¶
func (s *MemberSession) Notice(route string, input interface{}) error
notice 请求
func (*MemberSession) RpcRequest ¶
func (s *MemberSession) RpcRequest(ss *BaseSession, msg *deal.Msg) error
rpc 请求
type ServerSession ¶
type ServerSession struct {
*BaseSession
}
func GetServerSession ¶
func GetServerSession(h *core.TcpHandle) *ServerSession
func (*ServerSession) HandleRoute ¶
func (*ServerSession) Notice ¶
func (s *ServerSession) Notice(route string, input interface{}) error
func (*ServerSession) Push ¶
func (s *ServerSession) Push(route string, input interface{}) error
func (*ServerSession) PushTo ¶
func (s *ServerSession) PushTo(sid uint64, route string, input interface{}) error
func (*ServerSession) Response ¶
func (s *ServerSession) Response(route string, input interface{}) error
func (*ServerSession) Rpc ¶
func (s *ServerSession) Rpc(route string, input, output interface{}) error
func (*ServerSession) RpcResponse ¶
func (s *ServerSession) RpcResponse(route string, input interface{}) error
type Session ¶
type Session interface { // 获取客户端地址 GetAddr() string // 获取mid GetMid() uint64 // cache Set(k string, v interface{}) Get(k string) interface{} Del(k string) GetInt(k string) int GetUInt(k string) uint GetInt32(k string) int32 GetUInt32(k string) uint32 GetInt64(k string) int64 GetUInt64(k string) uint64 GetFloat(k string) float64 GetBool(k string) bool GetString(k string) string // session id SetSid(sid uint64) GetSid() uint64 // 远程调用 Rpc(route string, input, output interface{}) error Notice(route string, input interface{}) error Response(route string, input interface{}) error RpcResponse(route string, input interface{}) error Push(route string, input interface{}) error PushTo(sid uint64, route string, input interface{}) error SendTo(addr string, msg *deal.Msg) error HandleRoute(r *router.Router, m *deal.Msg) error }
Click to show internal directories.
Click to hide internal directories.