hub

package
v0.28.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 11 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 struct {
	Message  string
	SenderID string

	Annotations map[string]interface{}
}

Message gets converted to/from JSON and sent in the body of pubsub messages.

func NewMessage

func NewMessage(s string) *Message

func (*Message) AnnotationsToObj added in v0.13.0

func (m *Message) AnnotationsToObj(v interface{}) error

func (*Message) Apply

func (m *Message) Apply(opts ...MessageOption) error

Apply applies the given options to the config, returning the first error encountered (if any).

func (*Message) Copy

func (m *Message) Copy() *Message

func (*Message) WithMessage

func (m *Message) WithMessage(s string) *Message

type MessageHub added in v0.11.0

type MessageHub struct {
	sync.Mutex

	Messages, PublicMessages chan *Message
	// contains filtered or unexported fields
}

func NewHub added in v0.11.0

func NewHub(otp string, maxsize, keyLength, interval int, joinPublic bool) *MessageHub

func (*MessageHub) ListPeers added in v0.11.0

func (m *MessageHub) ListPeers() ([]peer.ID, error)

func (*MessageHub) PublishMessage added in v0.11.0

func (m *MessageHub) PublishMessage(mess *Message) error

func (*MessageHub) PublishPublicMessage added in v0.13.0

func (m *MessageHub) PublishPublicMessage(mess *Message) error

func (*MessageHub) Start added in v0.11.0

func (m *MessageHub) Start(ctx context.Context, host host.Host) error

type MessageOption

type MessageOption func(cfg *Message) error

Jump to

Keyboard shortcuts

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