Documentation ¶
Index ¶
- Variables
- func Accept(listener net.Listener) (net.Conn, error)
- type Channel
- func (channel *Channel) Close()
- func (channel *Channel) Fetch(callback func(*Session))
- func (channel *Channel) FetchAndRemove(callback func(*Session))
- func (channel *Channel) Get(key KEY) *Session
- func (channel *Channel) Len() int
- func (channel *Channel) Put(key KEY, session *Session)
- func (channel *Channel) Remove(key KEY) bool
- type ClearSendChan
- type Codec
- type Handler
- type HandlerFunc
- type ISessionHandler
- type KEY
- type Manager
- type Protocol
- type ProtocolFunc
- type Server
- type Session
- func (session *Session) AddCloseCallback(handler, key interface{}, callback func())
- func (session *Session) Close() error
- func (session *Session) Codec() Codec
- func (session *Session) ID() uint64
- func (session *Session) IsClosed() bool
- func (session *Session) Receive() (iMsg v3.IMessage, seq v3.MessageSeq, err error)
- func (session *Session) RemoveCloseCallback(handler, key interface{})
- func (session *Session) Send(iMsg v3.IMessage, seq v3.MessageSeq) error
- type SessionHandler
- type SessionID
Constants ¶
This section is empty.
Variables ¶
View Source
var SessionBlockedError = errors.New("Session Blocked")
View Source
var SessionClosedError = errors.New("Session Closed")
Functions ¶
Types ¶
type Channel ¶
type Channel struct { // channel state State interface{} // contains filtered or unexported fields }
func NewChannel ¶
func NewChannel() *Channel
func (*Channel) FetchAndRemove ¶
type ClearSendChan ¶
type HandlerFunc ¶
type HandlerFunc func(*Session)
func (HandlerFunc) HandleSession ¶
func (f HandlerFunc) HandleSession(session *Session)
type ISessionHandler ¶
type ISessionHandler interface { HandleMessage(*Session, []byte) HandleError(*Session, error) //HandleClose(*Session, int, string) error HandleConnect(*Session) error HandleDisconnect(*Session) }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager() *Manager
func (*Manager) GetSession ¶
func (*Manager) NewSession ¶
func (*Manager) SessionNum ¶
type ProtocolFunc ¶
type ProtocolFunc func(rw io.ReadWriter) (Codec, error)
func (ProtocolFunc) NewCodec ¶
func (pf ProtocolFunc) NewCodec(rw io.ReadWriter) (Codec, error)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) GetSession ¶
func (*Server) SessionNum ¶
type Session ¶
type Session struct { State interface{} // contains filtered or unexported fields }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func DialTimeout ¶
func NewSession ¶
func (*Session) AddCloseCallback ¶
func (session *Session) AddCloseCallback(handler, key interface{}, callback func())
func (*Session) RemoveCloseCallback ¶
func (session *Session) RemoveCloseCallback(handler, key interface{})
type SessionHandler ¶
type SessionHandler struct { }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (SessionHandler) HandleConnect ¶
func (SessionHandler) HandleConnect(*Session) error
func (SessionHandler) HandleDisconnect ¶
func (SessionHandler) HandleDisconnect(*Session)
func (SessionHandler) HandleError ¶
func (SessionHandler) HandleError(*Session, error)
func (SessionHandler) HandleMessage ¶
func (SessionHandler) HandleMessage(*Session, []byte)
Click to show internal directories.
Click to hide internal directories.