pubsub

package
v0.0.0-...-70d0519 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

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

func NewBroker

func NewBroker() *Broker

func (*Broker) AddSubscriber

func (b *Broker) AddSubscriber() *Subscriber

func (*Broker) Broadcast

func (b *Broker) Broadcast(msg string, topics []string)

func (*Broker) GetSubscribers

func (b *Broker) GetSubscribers(topic string) int

func (*Broker) Publish

func (b *Broker) Publish(topic string, msg string)

func (*Broker) RemoveSubscriber

func (b *Broker) RemoveSubscriber(s *Subscriber)

func (*Broker) Subscribe

func (b *Broker) Subscribe(s *Subscriber, topic string)

func (*Broker) Unsubscribe

func (b *Broker) Unsubscribe(s *Subscriber, topic string)

type Message

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

func NewMessage

func NewMessage(msg string, topic string) *Message

func (*Message) GetMessageBody

func (m *Message) GetMessageBody() string

func (*Message) GetTopic

func (m *Message) GetTopic() string

type Subscriber

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

func CreateNewSubscriber

func CreateNewSubscriber() (string, *Subscriber)

func (*Subscriber) AddTopic

func (s *Subscriber) AddTopic(topic string)

func (*Subscriber) Destruct

func (s *Subscriber) Destruct()

func (*Subscriber) GetTopics

func (s *Subscriber) GetTopics() []string

func (*Subscriber) Listen

func (s *Subscriber) Listen(w http.ResponseWriter)

func (*Subscriber) RemoveTopic

func (s *Subscriber) RemoveTopic(topic string)

func (*Subscriber) Signal

func (s *Subscriber) Signal(msg *Message)

type Subscribers

type Subscribers map[string]*Subscriber

Jump to

Keyboard shortcuts

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