Documentation ¶
Index ¶
- Variables
- func NewConnection(id uint32, conn *websocket.Conn, server xnet.Server) xnet.Connection
- func NewDispatch() xnet.Dispatcher
- func NewRequest(msg xnet.Message, conn *Connection) xnet.Request
- type Connection
- func (c *Connection) GetAttribute(key string) (any, bool)
- func (c *Connection) GetConnId() string
- func (c *Connection) SendBufferMesg(id uint32, data []byte) error
- func (c *Connection) SendMsg(id uint32, data []byte) error
- func (c *Connection) SetAttribute(key string, val any)
- func (c *Connection) Start()
- func (c *Connection) StartReader()
- func (c *Connection) StartWriter()
- func (c *Connection) Stop()
- type Disptach
- type Message
- type Request
- type Server
- func (s *Server) ChatWith(uid string, msgID uint32, data []byte) error
- func (s *Server) FactoryConnectionId() uint32
- func (s *Server) GetAcceptFunc() func([]byte) (bool, xnet.IdCreater)
- func (s *Server) GetConnManager() *xnet.ConnManager
- func (s *Server) GetConnectionByID(id string) (xnet.Connection, bool)
- func (s *Server) GetDispatcher() xnet.Dispatcher
- func (s *Server) GetID() int64
- func (s *Server) GetPool() *sync.Pool
- func (s *Server) GetServerOpt() *xnet.ServerOption
- func (s *Server) GetStates() xnet.States
- func (s *Server) RemoveConnectionId(id uint32)
- func (s *Server) Serve()
- func (s *Server) ServeWs(w http.ResponseWriter, r *http.Request)
- func (s *Server) SetAcceptFunc(accept func([]byte) (bool, xnet.IdCreater))
- func (s *Server) SetDistpatcher(dispatch xnet.Dispatcher)
- func (s *Server) SetHandShakeFaildFunc(handler func(w http.ResponseWriter))
- func (s *Server) SetPoolSize(size uint32)
- func (s *Server) Start()
- func (s *Server) Stop()
- type Subscribe
- type Wire
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrConnNotFound = errors.New("conn not found in server !")
Functions ¶
func NewConnection ¶
func NewDispatch ¶
func NewDispatch() xnet.Dispatcher
func NewRequest ¶
func NewRequest(msg xnet.Message, conn *Connection) xnet.Request
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) GetAttribute ¶
func (c *Connection) GetAttribute(key string) (any, bool)
func (*Connection) GetConnId ¶
func (c *Connection) GetConnId() string
func (*Connection) SendBufferMesg ¶
func (c *Connection) SendBufferMesg(id uint32, data []byte) error
func (*Connection) SetAttribute ¶
func (c *Connection) SetAttribute(key string, val any)
func (*Connection) Start ¶
func (c *Connection) Start()
func (*Connection) StartReader ¶
func (c *Connection) StartReader()
func (*Connection) StartWriter ¶
func (c *Connection) StartWriter()
func (*Connection) Stop ¶
func (c *Connection) Stop()
type Disptach ¶
type Disptach struct {
// contains filtered or unexported fields
}
func (*Disptach) SentToTaskQueue ¶
func (*Disptach) StartWookerPool ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) GetConnection ¶
func (r *Request) GetConnection() xnet.Connection
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(opt *xnet.ServerOption) *Server
func (*Server) GetConnManager ¶
func (s *Server) GetConnManager() *xnet.ConnManager
func (*Server) GetConnectionByID ¶
func (s *Server) GetConnectionByID(id string) (xnet.Connection, bool)
根据用户id 获取单个链接id
func (*Server) SetAcceptFunc ¶
func (*Server) SetHandShakeFaildFunc ¶
func (s *Server) SetHandShakeFaildFunc(handler func(w http.ResponseWriter))
设置握手失败处理方法
func (*Server) SetPoolSize ¶
type Subscribe ¶
type Subscribe struct {
// contains filtered or unexported fields
}
func NewSubscribe ¶
Click to show internal directories.
Click to hide internal directories.