Documentation
¶
Index ¶
- func NextSID() facade.SID
- type Component
- func (s *Component) AddOnClose(listener ...SessionListener)
- func (s *Component) AddOnCreate(listener ...SessionListener)
- func (s *Component) Bind(sid facade.SID, uid facade.UID) error
- func (s *Component) CloseAll()
- func (s *Component) Create(entity facade.INetwork) *Session
- func (s *Component) ForEachSIDSession(fn func(s *Session))
- func (s *Component) ForEachUIDSession(fn func(s *Session))
- func (s *Component) GetSessionCount() int
- func (s *Component) Import(sid facade.SID, key string, value interface{}) error
- func (s *Component) ImportAll(sid facade.SID, settings map[string]interface{}) error
- func (s *Component) Kick(uid facade.UID) error
- func (s *Component) KickBySID(sid facade.SID) error
- func (s *Component) Name() string
- func (s *Component) Unbind(sid facade.SID)
- type Group
- func (c *Group) Add(session *Session) error
- func (c *Group) Broadcast(route string, v interface{}) error
- func (c *Group) Close() error
- func (c *Group) Contains(uid int64) bool
- func (c *Group) Count() int
- func (c *Group) Leave(s *Session) error
- func (c *Group) LeaveAll() error
- func (c *Group) Member(uid int64) (*Session, error)
- func (c *Group) Members() []int64
- func (c *Group) Multicast(route string, v interface{}, filter SessionFilter) error
- type IComponent
- type Session
- func (s *Session) Bind(uid facade.UID) error
- func (s *Session) Clear()
- func (s *Session) Close()
- func (s *Session) Contains(key string) bool
- func (s *Session) Data() map[string]interface{}
- func (s *Session) Debug(args ...interface{})
- func (s *Session) Debugf(template string, args ...interface{})
- func (s *Session) Error(args ...interface{})
- func (s *Session) Errorf(template string, args ...interface{})
- func (s *Session) FrontendId() facade.FrontendId
- func (s *Session) GetFloat32(key string) float32
- func (s *Session) GetFloat64(key string) float64
- func (s *Session) GetInt(key string) int
- func (s *Session) GetInt16(key string) int16
- func (s *Session) GetInt32(key string) int32
- func (s *Session) GetInt64(key string) int64
- func (s *Session) GetInt8(key string) int8
- func (s *Session) GetString(key string) string
- func (s *Session) GetUint(key string) uint
- func (s *Session) GetUint16(key string) uint16
- func (s *Session) GetUint32(key string) uint32
- func (s *Session) GetUint64(key string) uint64
- func (s *Session) GetUint8(key string) uint8
- func (s *Session) GetValue(key string) interface{}
- func (s *Session) Info(args ...interface{})
- func (s *Session) Infof(template string, args ...interface{})
- func (s *Session) IsBind() bool
- func (s *Session) Kick(reason string, close bool)
- func (s *Session) OnCloseProcess()
- func (s *Session) Push(route string, v interface{}) error
- func (s *Session) RPC(route string, v interface{}) error
- func (s *Session) RemoteAddress() string
- func (s *Session) Remove(key string)
- func (s *Session) Response(mid uint, v interface{}) error
- func (s *Session) Restore(data map[string]interface{})
- func (s *Session) SID() facade.SID
- func (s *Session) SendRaw(bytes []byte) error
- func (s *Session) Set(key string, value interface{})
- func (s *Session) String() string
- func (s *Session) UID() facade.UID
- func (s *Session) Unbind()
- func (s *Session) Warn(args ...interface{})
- func (s *Session) Warnf(template string, args ...interface{})
- type SessionFilter
- type SessionListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Component ¶ added in v1.1.0
Component session component
func NewComponent ¶ added in v1.1.0
func NewComponent() *Component
func (*Component) AddOnClose ¶ added in v1.1.0
func (s *Component) AddOnClose(listener ...SessionListener)
func (*Component) AddOnCreate ¶ added in v1.1.0
func (s *Component) AddOnCreate(listener ...SessionListener)
func (*Component) ForEachSIDSession ¶ added in v1.1.0
func (*Component) ForEachUIDSession ¶ added in v1.1.0
func (*Component) GetSessionCount ¶ added in v1.1.0
type Group ¶ added in v1.1.0
type Group struct {
// contains filtered or unexported fields
}
Group represents a session group which used to manage a number of sessions, data send to the group will send to all session in it.
func (*Group) Close ¶ added in v1.1.0
func (c *Group) Close() error
Close destroy group, which will release all resource in the group
func (*Group) Contains ¶ added in v1.1.0
Contains check whether a UID is contained in current group or not
func (*Group) LeaveAll ¶ added in v1.1.0
func (c *Group) LeaveAll() error
LeaveAll clear all sessions in the group
func (*Group) Multicast ¶ added in v1.1.0
func (c *Group) Multicast(route string, v interface{}, filter SessionFilter) error
Multicast push the message to the filtered clients
type IComponent ¶ added in v1.1.0
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func (*Session) Clear ¶ added in v1.1.0
func (s *Session) Clear()
Clear releases all settings related to current sc
func (*Session) FrontendId ¶
func (s *Session) FrontendId() facade.FrontendId
func (*Session) GetFloat32 ¶ added in v1.1.0
Float32 returns the value associated with the key as a float32.
func (*Session) GetFloat64 ¶ added in v1.1.0
Float64 returns the value associated with the key as a float64.
func (*Session) GetInt16 ¶ added in v1.1.0
Int16 returns the value associated with the key as a int16.
func (*Session) GetInt32 ¶ added in v1.1.0
Int32 returns the value associated with the key as a int32.
func (*Session) GetInt64 ¶ added in v1.1.0
Int64 returns the value associated with the key as a int64.
func (*Session) GetString ¶ added in v1.1.0
String returns the value associated with the key as a string.
func (*Session) GetUint16 ¶ added in v1.1.0
Uint16 returns the value associated with the key as a uint16.
func (*Session) GetUint32 ¶ added in v1.1.0
Uint32 returns the value associated with the key as a uint32.
func (*Session) GetUint64 ¶ added in v1.1.0
Uint64 returns the value associated with the key as a uint64.
func (*Session) GetUint8 ¶ added in v1.1.0
Uint8 returns the value associated with the key as a uint8.
func (*Session) GetValue ¶ added in v1.1.0
func (s *Session) GetValue(key string) interface{}
Value returns the value associated with the key as a interface{}.
func (*Session) OnCloseProcess ¶ added in v1.1.0
func (s *Session) OnCloseProcess()
func (*Session) RemoteAddress ¶ added in v1.1.0
type SessionFilter ¶ added in v1.1.0
SessionFilter represents a filter which was used to filter session when Multicast, the session will receive the message while filter returns true.