pubsub

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Pubsub *pubsub.PubSub
View Source
var PubsubTopicPool = make(map[string]*PubsubTopic, 0)

Functions

func GetTopics

func GetTopics() []string

func ListPeers

func ListPeers(topicname string) []peer.ID

func RegistMessageHandler added in v0.1.24

func RegistMessageHandler(receiveHandler func(data []byte, remotePeerId string, clientId string, connectSessionId string, remoteAddr string) ([]byte, error))

func SendRaw

func SendRaw(topicname string, data []byte)

Types

type PubsubTopic

type PubsubTopic struct {
	Topic *pubsub.Topic
	Sub   *pubsub.Subscription
}

* 订阅主题和订阅者

func Subscribe

func Subscribe(topicname string) (*PubsubTopic, error)

* 订阅主题,可以接收发给这个主题的消息

Jump to

Keyboard shortcuts

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