hub

package
v0.0.0-...-bf94cd9 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Pool      *redis.Pool
	RedisConn *redis.Conn
)

Functions

func Get

func Get(key string) (string, error)

func HubServer

func HubServer()

*

  • 监听客户端连接

func LoadSessionFromRedis

func LoadSessionFromRedis()

func NewPool

func NewPool(server, password string) *redis.Pool

func RedisInit

func RedisInit()

func Set

func Set(key string, args ...interface{}) (bool, error)

func TickSyncSession

func TickSyncSession()

func TickWorkerServer

func TickWorkerServer()

Types

type Api

type Api struct {
	Init func()
}

func (*Api) AddCron

func (api *Api) AddCron(expression string, exefnc func()) bool

func (*Api) AreaAddSid

func (api *Api) AreaAddSid(sid string, area_id string) bool

func (*Api) AreaKickSid

func (api *Api) AreaKickSid(sid string, area_id string) bool

func (*Api) Broadcast

func (this *Api) Broadcast(sid string, area_id string, msg []byte) bool

func (*Api) BroadcastAll

func (api *Api) BroadcastAll(msg []byte) bool

func (*Api) CreateArea

func (api *Api) CreateArea(id string, name string) bool

func (*Api) Disable

func (api *Api) Disable() bool

func (*Api) Enable

func (api *Api) Enable() bool

func (*Api) Get

func (api *Api) Get(key string) bool

func (*Api) GetAllSession

func (api *Api) GetAllSession() string

func (*Api) GetAreas

func (api *Api) GetAreas() map[string]string

func (*Api) GetAreasKey

func (api *Api) GetAreasKey() []string

func (*Api) GetBase

func (api *Api) GetBase() string

获取服务器的根路径

func (*Api) GetEnableStatus

func (api *Api) GetEnableStatus() bool

func (*Api) GetSession

func (api *Api) GetSession(sid string) string

func (*Api) GetSidsByArea

func (api *Api) GetSidsByArea(channel_id string) string

func (*Api) GetUserJoinedAreas

func (api *Api) GetUserJoinedAreas(sid string) string

func (*Api) Kick

func (api *Api) Kick(sid string) bool

func (*Api) Push

func (api *Api) Push(to_sid, from_sid string, data_buf []byte) bool

func (*Api) PushBySids

func (api *Api) PushBySids(from_sid string, to_sids []string, data_buf []byte) bool

func (*Api) RemoveArea

func (api *Api) RemoveArea(id string) bool

func (*Api) RemoveCron

func (api *Api) RemoveCron(expression string) bool

func (*Api) Set

func (api *Api) Set(key string, value string) bool

func (*Api) UpdateSession

func (this *Api) UpdateSession(sid string, data string) bool

Jump to

Keyboard shortcuts

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