subpub

package
v1.2.24012 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: BSD-3-Clause Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ACTION_RECV_TOPIC_DATA = 11
	ACTION_SEND_BUF        = 5

	ACTION_CONNECTED      = 200
	ACTION_DISCONNECTED   = 201
	ACTION_CONNECTFAIL    = 202
	ACTION_BEFORE_CONNECT = 203
	ACTION_CLOSE          = 204
	ACTION_ERROR          = 205

	ACTION_CUSTOM = 220
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PubHub

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

发布中心 负责创建管理会话对象 注册的方法必须是pub.开头

func NewPubHub

func NewPubHub() *PubHub

func (*PubHub) AddSession

func (this *PubHub) AddSession(sessionid string, conf gobase.StrMap, notifyFn gobase.SubFunc) error

使用conntype参数, 调用pub.[xxx]注册的方法, 创建一个Pub会话对象

false: 如果sessionid已经存在; conntype参数未注册

func (*PubHub) DelSession

func (this *PubHub) DelSession(sessionid string) bool

关闭移除一个会话

func (*PubHub) Pub

func (this *PubHub) Pub(sessionid string, topic string, max int, args ...interface{}) int

发布数据

type PubSessionIntf

type PubSessionIntf interface {
	Start()
	Close() error

	// 发布数据
	Pub(topic string, max int, args ...interface{}) int
}

创建的Session对象必须要实现的接口方法

type SubHub

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

订阅中心 负责创建管理会话对象 注册的方法必须是sub.开头

func NewSubHub

func NewSubHub() *SubHub

func (*SubHub) AddSession

func (this *SubHub) AddSession(sessionid string, conf gobase.StrMap, fn gobase.SubFunc) error

func (*SubHub) DelSession

func (this *SubHub) DelSession(sessionid string) bool

func (*SubHub) PostData

func (this *SubHub) PostData(sessionid string, args ...interface{}) error

type SubSessionIntf

type SubSessionIntf interface {
	Start()
	Close() error
	PostData(args ...interface{}) error
}

Jump to

Keyboard shortcuts

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