pubsub

package
v0.0.0-...-e14b457 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message interface {
	Broker() MessageBroker
	Topic() string
	Payload() []byte
}

Message is an interface because I'm one of the cool kids.

func NewMessage

func NewMessage(broker MessageBroker, topic string, payload []byte) Message

NewMessage returns an actual implementation for Message, which is useful in creating your own PubSub implementation. Lots of copies, but I really don't care at the moment.

type MessageBroker

type MessageBroker interface {
	Disconnect(quiesce uint)
	Publish(topic string, qos byte, retain bool, data []byte)
	Subscribe(topic string, qos byte, callback func(Message))
}

MessageBroker is a subset of MQTT functionality since I'm currently using MQTT for pub/sub. I suppose it will change a bit if I switch to another protocol.

It is only in a module to get out of naming hell. A namespace is useful here.

Jump to

Keyboard shortcuts

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