cherrySession

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	INIT   = 0
	CLOSED = 1
)
View Source
var (
	IllegalUID = cherryUtils.Error("illegal uid")
)

Functions

func NextSessionId

func NextSessionId() int64

Types

type Session

type Session struct {
	Settings
	// contains filtered or unexported fields
}

func NewSession

func NewSession(sid cherryInterfaces.SID, conn net.Conn, net cherryInterfaces.INetworkEntity, sessionComponent *SessionComponent) *Session

func (*Session) Bind

func (s *Session) Bind(uid cherryInterfaces.UID) error

func (*Session) Closed

func (s *Session) Closed()

func (*Session) Conn

func (s *Session) Conn() net.Conn

func (*Session) FrontendId

func (s *Session) FrontendId() cherryInterfaces.FrontendId

func (*Session) Net

func (s *Session) Net() cherryInterfaces.INetworkEntity

func (*Session) OnClose

func (s *Session) OnClose(listener cherryInterfaces.SessionListener)

func (*Session) OnError

func (s *Session) OnError(listener cherryInterfaces.SessionListener)

func (*Session) OnMessage

func (s *Session) OnMessage(listener cherryInterfaces.MessageListener)

func (*Session) SID

func (s *Session) SID() cherryInterfaces.SID

func (*Session) Send

func (s *Session) Send(msg []byte) error

func (*Session) SendBatch

func (s *Session) SendBatch(batchMsg ...[]byte)

func (*Session) SetStatus

func (s *Session) SetStatus(status int)

func (*Session) Start

func (s *Session) Start()

func (*Session) Status

func (s *Session) Status() int

func (*Session) String

func (s *Session) String() string

func (*Session) UID

func (s *Session) UID() cherryInterfaces.UID

type SessionComponent

type SessionComponent struct {
	cherryInterfaces.BaseComponent
	// contains filtered or unexported fields
}

SessionComponent session sessionComponent

func NewService

func NewService() *SessionComponent

func (*SessionComponent) Bind

func (s *SessionComponent) Bind(sid cherryInterfaces.SID, uid cherryInterfaces.UID) error

func (*SessionComponent) Create

func (s *SessionComponent) Create(conn net.Conn, net cherryInterfaces.INetworkEntity) *Session

func (*SessionComponent) Name

func (s *SessionComponent) Name() string

func (*SessionComponent) Remove

func (s *SessionComponent) Remove(sid cherryInterfaces.SID)

type Settings

type Settings struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Settings) Clear

func (s *Settings) Clear()

Clear releases all settings related to current sessionComponent

func (*Settings) Contains

func (s *Settings) Contains(key string) bool

func (*Settings) Data

func (s *Settings) Data() map[string]interface{}

func (*Settings) GetFloat32

func (s *Settings) GetFloat32(key string) float32

Float32 returns the value associated with the key as a float32.

func (*Settings) GetFloat64

func (s *Settings) GetFloat64(key string) float64

Float64 returns the value associated with the key as a float64.

func (*Settings) GetInt

func (s *Settings) GetInt(key string) int

func (*Settings) GetInt8

func (s *Settings) GetInt8(key string) int8

Int8 returns the value associated with the key as a int8.

func (*Settings) GetInt16

func (s *Settings) GetInt16(key string) int16

Int16 returns the value associated with the key as a int16.

func (*Settings) GetInt32

func (s *Settings) GetInt32(key string) int32

Int32 returns the value associated with the key as a int32.

func (*Settings) GetInt64

func (s *Settings) GetInt64(key string) int64

Int64 returns the value associated with the key as a int64.

func (*Settings) GetString

func (s *Settings) GetString(key string) string

String returns the value associated with the key as a string.

func (*Settings) GetUint

func (s *Settings) GetUint(key string) uint

Uint returns the value associated with the key as a uint.

func (*Settings) GetUint8

func (s *Settings) GetUint8(key string) uint8

Uint8 returns the value associated with the key as a uint8.

func (*Settings) GetUint16

func (s *Settings) GetUint16(key string) uint16

Uint16 returns the value associated with the key as a uint16.

func (*Settings) GetUint32

func (s *Settings) GetUint32(key string) uint32

Uint32 returns the value associated with the key as a uint32.

func (*Settings) GetUint64

func (s *Settings) GetUint64(key string) uint64

Uint64 returns the value associated with the key as a uint64.

func (*Settings) GetValue

func (s *Settings) GetValue(key string) interface{}

Value returns the value associated with the key as a interface{}.

func (*Settings) Remove

func (s *Settings) Remove(key string)

func (*Settings) Restore

func (s *Settings) Restore(data map[string]interface{})

func (*Settings) Set

func (s *Settings) Set(key string, value interface{})

Jump to

Keyboard shortcuts

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