mqtt_paho

package module
v2.0.0-...-24f83eb Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WritePubMessage

func WritePubMessage(ctx context.Context, m binding.Message, pubMessage *paho.Publish, transformers ...binding.Transformer) error

WritePubMessage fills the provided pubMessage with the message m. Using context you can tweak the encoding processing (more details on binding.Write documentation).

Types

type Message

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

Message represents a MQTT message. This message *can* be read several times safely

func NewMessage

func NewMessage(msg *paho.Publish) *Message

func (*Message) Finish

func (m *Message) Finish(error) error

func (*Message) GetAttribute

func (m *Message) GetAttribute(k spec.Kind) (spec.Attribute, interface{})

func (*Message) GetExtension

func (m *Message) GetExtension(name string) interface{}

func (*Message) ReadBinary

func (m *Message) ReadBinary(ctx context.Context, encoder binding.BinaryWriter) (err error)

func (*Message) ReadEncoding

func (m *Message) ReadEncoding() binding.Encoding

func (*Message) ReadStructured

func (m *Message) ReadStructured(ctx context.Context, encoder binding.StructuredWriter) error

type Option

type Option func(*Protocol) error

Option is the function signature required to be considered an mqtt_paho.Option.

func WithConnect

func WithConnect(connOpt *paho.Connect) Option

WithConnect sets the paho.Connect configuration for the client. This option is not required.

func WithPublish

func WithPublish(publishOpt *paho.Publish) Option

WithPublish sets the paho.Publish configuration for the client. This option is required if you want to send messages.

func WithSubscribe

func WithSubscribe(subscribeOpt *paho.Subscribe) Option

WithSubscribe sets the paho.Subscribe configuration for the client. This option is required if you want to receive messages.

type Protocol

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

func New

func New(ctx context.Context, config *paho.ClientConfig, opts ...Option) (*Protocol, error)

func (*Protocol) Close

func (p *Protocol) Close(ctx context.Context) error

func (*Protocol) OpenInbound

func (p *Protocol) OpenInbound(ctx context.Context) error

func (*Protocol) Receive

func (p *Protocol) Receive(ctx context.Context) (binding.Message, error)

Receive implements Receiver.Receive

func (*Protocol) Send

func (p *Protocol) Send(ctx context.Context, m binding.Message, transformers ...binding.Transformer) error

Jump to

Keyboard shortcuts

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