connector

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	Write(data *[]byte)
	LocalAddr() net.Addr
	RemoteAddr() net.Addr
	Close()
	UserData() interface{}
	SetUserData(data interface{})
	GetSession() *rpc.Session
	PushMessage(uint32, []byte)
	KickMessage(string)
}

type ChannelRemote

type ChannelRemote struct {
	// contains filtered or unexported fields
}

func NewChannelRemote

func NewChannelRemote(conn Connector) *ChannelRemote

func (*ChannelRemote) Broadcast

func (c *ChannelRemote) Broadcast(ctx context.Context, args *rpc.ArgsGroup, reply *rpc.ReplyGroup) error

Broadcast to all the client connectd with current frontend server.

func (*ChannelRemote) PushMessageByGroup

func (c *ChannelRemote) PushMessageByGroup(ctx context.Context, args *rpc.ArgsGroup, reply *rpc.ReplyGroup) error

Push message to client by uids.

type Connection

type Connection interface {
	OnDisconnect(session *rpc.Session)
}

type Connector

type Connector interface {
	GetSessionMap() *SessionMap
}

type SessionMap

type SessionMap struct {
	// contains filtered or unexported fields
}

goroutine safe

func (*SessionMap) AddSession

func (s *SessionMap) AddSession(a Agent)

func (*SessionMap) DelSession

func (s *SessionMap) DelSession(a Agent)

func (*SessionMap) GetAgent

func (s *SessionMap) GetAgent(sessionId int64) (Agent, error)

func (*SessionMap) GetSessionCount

func (s *SessionMap) GetSessionCount() int32

func (*SessionMap) Range

func (s *SessionMap) Range(f func(k, v interface{}) bool)

type SessionRemote

type SessionRemote struct {
	// contains filtered or unexported fields
}

func NewSessionRemote

func NewSessionRemote(c Connector) *SessionRemote

func (*SessionRemote) Bind

func (s *SessionRemote) Bind(ctx context.Context, args *rpc.Args, reply *rpc.Reply) error

func (*SessionRemote) GetSessionCount

func (s *SessionRemote) GetSessionCount(ctx context.Context, args *rpc.Args, reply *rpc.Reply) error

func (*SessionRemote) KickBySid

func (s *SessionRemote) KickBySid(ctx context.Context, args *rpc.Args, reply *rpc.Reply) error

func (*SessionRemote) Push

func (s *SessionRemote) Push(ctx context.Context, args *rpc.Args, reply *rpc.Reply) error

func (*SessionRemote) UnBind

func (s *SessionRemote) UnBind(ctx context.Context, args *rpc.Args, reply *rpc.Reply) error

type TimeJob

type TimeJob struct {
	// contains filtered or unexported fields
}

type Timers

type Timers struct {
	// contains filtered or unexported fields
}

func NewTimer

func NewTimer() *Timers

func (*Timers) AfterFunc

func (t *Timers) AfterFunc(d time.Duration, cb func()) *timer.Timer

func (*Timers) ClearTimeout

func (t *Timers) ClearTimeout(handler *timer.Timer)

func (*Timers) CronFunc

func (t *Timers) CronFunc(cronExpr *timer.CronExpr, cb func()) *timer.Cron

func (*Timers) RunTimer

func (t *Timers) RunTimer(closeSig chan bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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