Documentation ¶
Index ¶
- Variables
- type Conn
- func (self *Conn) Close() error
- func (self *Conn) Kick(reason string) error
- func (self *Conn) Push(route string, data []byte) error
- func (self *Conn) Recv(ctx context.Context) (msg *Message, err error)
- func (self *Conn) RemoteAddr() net.Addr
- func (self *Conn) Response(mid uint64, data []byte) error
- func (self *Conn) SendServerDownPacket(reason string) error
- func (self *Conn) SendServerMaintainPacket(reason string) error
- func (self *Conn) SendServerResumePacket(reason string) error
- func (self *Conn) SendServerSuspendPacket(reason string) error
- func (self *Conn) String() string
- type Message
- type MiddleWareInterface
- type Option
- func WithCheckOriginFunc(fn func(*http.Request) bool) Option
- func WithDebugMode(v bool) Option
- func WithDictionary(dict map[string]uint16) Option
- func WithHandshakeTimeout(d time.Duration) Option
- func WithHandshakeValidator(fn func([]byte) error) Option
- func WithHeartbeatInterval(d time.Duration) Option
- func WithIsWebsocket(enableWs bool) Option
- func WithRSAPrivateKey(keyFile string) Option
- func WithRecvBacklog(v int) Option
- func WithRecvBuffSize(v int) Option
- func WithSendBacklog(v int) Option
- func WithSessionModifer(v uint64) Option
- func WithTSLConfig(certificate, key string) Option
- func WithWSPath(path string) Option
- type Server
- type Session
- func (s *Session) Bind(uid int64) error
- func (s *Session) Clear()
- func (s *Session) Close() error
- func (s *Session) Float32(key string) float32
- func (s *Session) Float64(key string) float64
- func (s *Session) HasKey(key string) bool
- func (s *Session) Id() uint64
- func (s *Session) Int(key string) int
- func (s *Session) Int16(key string) int16
- func (s *Session) Int32(key string) int32
- func (s *Session) Int64(key string) int64
- func (s *Session) Int8(key string) int8
- func (s *Session) Kick(reason string)
- func (s *Session) Push(route string, data []byte) error
- func (s *Session) Recv(ctx context.Context) (gira.GatewayMessage, error)
- func (s *Session) RemoteAddr() net.Addr
- func (s *Session) Remove(key string)
- func (s *Session) Response(mid uint64, data []byte) error
- func (s *Session) Restore(data map[string]interface{})
- func (s *Session) SendServerDown(reason string)
- func (s *Session) SendServerMaintain(reason string)
- func (s *Session) SendServerResume(reason string)
- func (s *Session) SendServerSuspend(reason string)
- func (s *Session) Set(key string, value interface{})
- func (s *Session) SetUserData(value interface{})
- func (s *Session) State() map[string]interface{}
- func (s *Session) String(key string) string
- func (s *Session) UID() int64
- func (s *Session) Uint(key string) uint
- func (s *Session) Uint16(key string) uint16
- func (s *Session) Uint32(key string) uint32
- func (s *Session) Uint64(key string) uint64
- func (s *Session) Uint8(key string) uint8
- func (s *Session) UserData() interface{}
- func (s *Session) Value(key string) interface{}
- type Stat
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSessionOnNotify = errors.New("current session working on notify mode") ErrCloseClosedSession = errors.New("close closed session") ErrInvalidRegisterReq = errors.New("invalid register request") ErrBrokenPipe = errors.New("broken low-level pipe") ErrBufferExceed = errors.New("session send buffer exceed") ErrCloseClosedGroup = errors.New("close closed group") ErrClosedGroup = errors.New("group closed") ErrMemberNotFound = errors.New("member not found in the group") ErrSessionDuplication = errors.New("session has existed in the current group") ErrSprotoRequestType = errors.New("sproto request type") ErrSprotoResponseType = errors.New("sproto response type") ErrHandShake = errors.New("handshake failed") ErrHeartbeatTimeout = errors.New("heartbeat timeout") ErrDialTimeout = errors.New("dial timeout") ErrDialInterrupt = errors.New("dial interrupt") ErrInvalidAddress = errors.New("invalid address") ErrInvalidMessage = errors.New("invalid message") ErrInvalidHandler = errors.New("invalid handler") ErrInvalidPacket = errors.New("invalid packet") ErrNotHandshake = errors.New("没握手成功就发了数据包过来") ErrNotWorking = errors.New("非正常状态,无法发送消息") ErrInvalidState = errors.New("invalid state") ErrKick = errors.New("被踢下线") ErrConnClosed = errors.New("连接已关闭") ErrConnNotReady = errors.New("连接末准备好") ErrHandShakeAck = errors.New("handshake ack 出错") )
View Source
var (
ErrIllegalUID = errors.New("illegal uid")
)
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) Recv ¶
返回接收到的消息 即使链接已经关闭,也会返回已经接收到的消息,直到没有可处理的消息为止,则返回ErrBrokenPipe Returns: msg - 返回接收到的消息 err - 如果连接已关闭, 且没有消息了, 则返回ErrBrokenPipe
func (*Conn) RemoteAddr ¶
func (*Conn) SendServerDownPacket ¶
func (*Conn) SendServerMaintainPacket ¶
func (*Conn) SendServerResumePacket ¶
func (*Conn) SendServerSuspendPacket ¶
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func (*Message) Session ¶
func (r *Message) Session() gira.GatewayConn
type MiddleWareInterface ¶
type Option ¶
type Option func(gateway *Server)
func WithDebugMode ¶
func WithDictionary ¶
func WithHandshakeTimeout ¶
func WithHandshakeValidator ¶
func WithHeartbeatInterval ¶
func WithIsWebsocket ¶
func WithRSAPrivateKey ¶
func WithRecvBacklog ¶
func WithRecvBuffSize ¶
func WithSendBacklog ¶
func WithSessionModifer ¶
func WithTSLConfig ¶
func WithWSPath ¶
type Server ¶
type Server struct { BindAddr string Host string Port int32 Stat Stat // contains filtered or unexported fields }
func NewConfigServer ¶
func (*Server) UseMiddleware ¶
func (server *Server) UseMiddleware(m MiddleWareInterface)
type Session ¶
func (*Session) RemoteAddr ¶
func (*Session) SendServerDown ¶
func (*Session) SendServerMaintain ¶
func (*Session) SendServerResume ¶
func (*Session) SendServerSuspend ¶
func (*Session) SetUserData ¶
func (s *Session) SetUserData(value interface{})
Click to show internal directories.
Click to hide internal directories.