pubsub

package
v0.0.0-...-996fa4a Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service represents a publish service.

func New

func New(auth service.Authorizer, store storage.Storage, notifier service.Notifier, trie *message.Trie) *Service

New creates a new publisher service.

func (*Service) Handle

func (s *Service) Handle(request string, handler service.Handler)

Handle adds a handler for an "emitter/..." request

func (*Service) OnLastWill

func (s *Service) OnLastWill(sub message.Subscriber, ev *event.Connection) bool

OnLastWill publishes a last will event of the subscriber.

func (*Service) OnPublish

func (s *Service) OnPublish(c service.Conn, packet *mqtt.Publish) *errors.Error

OnPublish is a handler for MQTT Publish events.

func (*Service) OnSubscribe

func (s *Service) OnSubscribe(c service.Conn, mqttTopic []byte) *errors.Error

OnSubscribe is a handler for MQTT Subscribe events.

func (*Service) OnUnsubscribe

func (s *Service) OnUnsubscribe(c service.Conn, mqttTopic []byte) *errors.Error

OnUnsubscribe is a handler for MQTT Unsubscribe events.

func (*Service) Publish

func (s *Service) Publish(m *message.Message, filter func(message.Subscriber) bool) (n int64)

Publish publishes a message to everyone and returns the number of outgoing bytes written.

func (*Service) Subscribe

func (s *Service) Subscribe(sub message.Subscriber, ev *event.Subscription) bool

Subscribe subscribes to a channel.

func (*Service) Unsubscribe

func (s *Service) Unsubscribe(sub message.Subscriber, ev *event.Subscription) (ok bool)

Unsubscribe unsubscribes from a channel

Jump to

Keyboard shortcuts

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