Documentation
¶
Index ¶
- Constants
- type ClientCodec
- type ClientRequest
- type Codec
- type Message
- type Session
- func (s *Session) Close()
- func (s *Session) Decode(data []byte) ([]Message, error)
- func (s *Session) Id() int64
- func (s *Session) Kick() error
- func (s *Session) Push(data []byte, pid uint32) error
- func (s *Session) PushBatch(msgs []Message) error
- func (s *Session) Send(data []byte) error
- func (s *Session) SendData(data []byte, seq uint32, pid uint32) error
- func (s *Session) SendMessageBatch(msgs []Message) error
- func (s *Session) Uid() int64
Constants ¶
View Source
const ( PatternNone = iota PatternKick )
View Source
const (
HeaderSize = 12 // 包体长度(4byte) | seq(4byte) | 协议号(4byte)
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientCodec ¶
type ClientCodec struct{}
ClientCodec 客户端编解码器
type ClientRequest ¶
type ClientRequest struct {
// contains filtered or unexported fields
}
func NewClientRequest ¶
func NewClientRequest(seq uint32, pid uint32, in []byte, session *Session) *ClientRequest
func (*ClientRequest) ResponseBatch ¶
func (r *ClientRequest) ResponseBatch(msgs []Message) error
type Codec ¶
type Codec struct{}
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func NewSession(uid int64, stream mux.IServerConn) *Session
NewSession 创建新的会话,自动分配全局唯一ID
func (*Session) SendMessageBatch ¶
Click to show internal directories.
Click to hide internal directories.