service

package
v0.0.0-...-1dd846c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2014 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_CLIENTS = 1000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInfo

type ClientInfo map[string]string

type ClientMap

type ClientMap map[string]ClientInfo

type ConnectionService

type ConnectionService struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewConnectionService

func NewConnectionService(serverId, config string) *ConnectionService

func (*ConnectionService) Add

func (cs *ConnectionService) Add(uid, info string)

Add Client

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

func (*Session) Close

func (s *Session) Close(reason string)

func (*Session) Get

func (s *Session) Get(k string) (v interface{}, ok bool)

func (*Session) Set

func (s *Session) Set(k string, v interface{})

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) Get

func (ss *SessionService) Get(sid string) (s *Session, ok bool)

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
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL