Documentation ¶
Index ¶
- Constants
- type ClientInfo
- type ClientMap
- type ConnectionService
- type FrontendSession
- func (fs *FrontendSession) Bind(uid string) error
- func (fs *FrontendSession) Get(k string) (v interface{}, ok bool)
- func (fs *FrontendSession) Push(k string) error
- func (fs *FrontendSession) PushAll() error
- func (fs *FrontendSession) Set(k string, v interface{})
- func (fs *FrontendSession) Unbind(uid string) error
- type Session
- type SessionService
- func (ss *SessionService) Bind(sid, uid string) error
- func (ss *SessionService) CreateSession(sid, frontendId string, conn Connector.Connector) (s *Session)
- func (ss *SessionService) ForeachBindedSess(scb func(s *Session))
- func (ss *SessionService) ForeachSess(scb func(s *Session))
- func (ss *SessionService) Get(sid string) (s *Session, ok bool)
- func (ss *SessionService) GetByUid(uid string) (ses []Session, ok bool)
- func (ss *SessionService) GetSessCount() int
- func (ss *SessionService) Import(sid, k string, v interface{}) error
- func (ss *SessionService) ImportAll(sid string, settings map[string]interface{}) error
- func (ss *SessionService) Kick(uid, reason string)
- func (ss *SessionService) KickBySessionId(sid string)
- func (ss *SessionService) Remove(sid string)
- func (ss *SessionService) SendMessage(sid string, data []byte) error
- func (ss *SessionService) SendMessageByUid(uid string, data []byte) error
- func (ss *SessionService) Unbind(sid, uid string) error
- type SessionState
Constants ¶
View Source
const (
MAX_CLIENTS = 1000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientInfo ¶
type ClientMap ¶
type ClientMap map[string]ClientInfo
type ConnectionService ¶
func NewConnectionService ¶
func NewConnectionService(serverId, config string) *ConnectionService
func (*ConnectionService) DecrCount ¶
func (cs *ConnectionService) DecrCount(uid string)
func (*ConnectionService) IncrCount ¶
func (cs *ConnectionService) IncrCount()
func (*ConnectionService) Remove ¶
func (cs *ConnectionService) Remove(uid string)
func (*ConnectionService) UpdateInfo ¶
func (cs *ConnectionService) UpdateInfo(uid, info string)
Update client info
type FrontendSession ¶
type FrontendSession struct {
// contains filtered or unexported fields
}
func NewFrontendSession ¶
func NewFrontendSession(s *Session) *FrontendSession
func (*FrontendSession) Bind ¶
func (fs *FrontendSession) Bind(uid string) error
func (*FrontendSession) Get ¶
func (fs *FrontendSession) Get(k string) (v interface{}, ok bool)
func (*FrontendSession) Push ¶
func (fs *FrontendSession) Push(k string) error
func (*FrontendSession) PushAll ¶
func (fs *FrontendSession) PushAll() error
func (*FrontendSession) Set ¶
func (fs *FrontendSession) Set(k string, v interface{})
func (*FrontendSession) Unbind ¶
func (fs *FrontendSession) Unbind(uid string) error
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func NewSession(sid, frontendId string, conn Connector.Connector, service *SessionService) *Session
type SessionService ¶
type SessionService struct {
// contains filtered or unexported fields
}
func NewSessionService ¶
func NewSessionService() *SessionService
func (*SessionService) Bind ¶
func (ss *SessionService) Bind(sid, uid string) error
Bind the session with a user id.
func (*SessionService) CreateSession ¶
func (ss *SessionService) CreateSession(sid, frontendId string, conn Connector.Connector) (s *Session)
func (*SessionService) ForeachBindedSess ¶
func (ss *SessionService) ForeachBindedSess(scb func(s *Session))
func (*SessionService) ForeachSess ¶
func (ss *SessionService) ForeachSess(scb func(s *Session))
func (*SessionService) GetByUid ¶
func (ss *SessionService) GetByUid(uid string) (ses []Session, ok bool)
func (*SessionService) GetSessCount ¶
func (ss *SessionService) GetSessCount() int
func (*SessionService) Import ¶
func (ss *SessionService) Import(sid, k string, v interface{}) error
func (*SessionService) ImportAll ¶
func (ss *SessionService) ImportAll(sid string, settings map[string]interface{}) error
func (*SessionService) Kick ¶
func (ss *SessionService) Kick(uid, reason string)
func (*SessionService) KickBySessionId ¶
func (ss *SessionService) KickBySessionId(sid string)
func (*SessionService) Remove ¶
func (ss *SessionService) Remove(sid string)
func (*SessionService) SendMessage ¶
func (ss *SessionService) SendMessage(sid string, data []byte) error
func (*SessionService) SendMessageByUid ¶
func (ss *SessionService) SendMessageByUid(uid string, data []byte) error
func (*SessionService) Unbind ¶
func (ss *SessionService) Unbind(sid, uid string) error
Unbind a session with the user id.
type SessionState ¶
type SessionState int8
Session State
const ( ST_INITED SessionState = iota ST_CLOSED )
Click to show internal directories.
Click to hide internal directories.