client

package
v0.0.0-...-edd4e79 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReceivedConnect = uint64(1 << iota)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ID string `json:"id"`

	QoS2 *HandleQoS2
	// contains filtered or unexported fields
}

func NewClient

func NewClient(conn net.Conn, option ...Option) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) GetID

func (c *Client) GetID() string

func (*Client) GetSession

func (c *Client) GetSession() broker.Session

func (*Client) GetTopicAlias

func (c *Client) GetTopicAlias(u uint16) string

func (*Client) HandlePubAck

func (c *Client) HandlePubAck(pubAck *packets.Puback)

func (*Client) HandlePubComp

func (c *Client) HandlePubComp(pubRel *packets.Pubcomp)

func (*Client) HandlePubRec

func (c *Client) HandlePubRec(pubRec *packets.Pubrec)

func (*Client) HandleSub

func (c *Client) HandleSub(subscribe *packets.Subscribe) map[string]byte

func (*Client) HandleUnSub

func (c *Client) HandleUnSub(topicName string)

func (*Client) IsState

func (c *Client) IsState(state uint64) bool

func (*Client) MetaString

func (c *Client) MetaString() string

func (*Client) Publish

func (c *Client) Publish(topic string, message *packet.PublishMessage) error

func (*Client) RemState

func (c *Client) RemState(state uint64)

func (*Client) Run

func (c *Client) Run(ctx context.Context, handler Handler)

func (*Client) SetConnectProperties

func (c *Client) SetConnectProperties(properties *broker.SessionConnectProperties)

func (*Client) SetID

func (c *Client) SetID(id string)

func (*Client) SetMeta

func (c *Client) SetMeta(session broker.Session, keepAlive time.Duration) error

func (*Client) SetState

func (c *Client) SetState(state uint64)

func (*Client) SetTopicAlias

func (c *Client) SetTopicAlias(topic string, alias uint16)

func (*Client) SetWill

func (c *Client) SetWill(message *broker.WillMessage) error

func (*Client) Write

func (c *Client) Write(data []byte) error

func (*Client) WritePacket

func (c *Client) WritePacket(packet packets.Packet)

type Config

type Config struct {
	WindowSize       int
	ReadStoreTimeout time.Duration
}

type HandleQoS2

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

func NewHandleQoS2

func NewHandleQoS2() *HandleQoS2

func (*HandleQoS2) HandlePubRel

func (w *HandleQoS2) HandlePubRel(pubrel *packets.Pubrel) (*packets.Publish, bool)

func (*HandleQoS2) HandlePublish

func (w *HandleQoS2) HandlePublish(publish *packets.Publish) bool

type Handler

type Handler interface {
	HandlePacket(*Client, *packets.ControlPacket)
}

type Meta

type Meta struct {
}

type NotifyClientClose

type NotifyClientClose interface {
	NotifyClientClose(c *Client)
	NotifyWillMessage(message *broker.WillMessage)
}

type Option

type Option func(*Options)

func WithConfig

func WithConfig(cfg Config) Option

func WithNotifyClose

func WithNotifyClose(notifyClose NotifyClientClose) Option

func WithStore

func WithStore(store broker.TopicMessageStore) Option

type Options

type Options struct {
	Store broker.TopicMessageStore
	// contains filtered or unexported fields
}

type PacketIDFactory

type PacketIDFactory interface {
	Generate() uint16
}

type Property

type Property struct {
	SessionExpiredInterval time.Duration
	ReceiveMaximum         uint16
	MaximumPacketSize      uint32
	TopicAliasMaximum      uint16
	RequestResponseInfo    bool
	RequestProblemInfo     bool
	UserProperty           map[string]string
	AuthenticationMethod   string
	AuthenticationData     []byte
}

type QoS2Message

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

type WillProperty

type WillProperty struct {
	WillDelayInterval      time.Duration
	PayloadFormatIndicator bool
	MessageExpiryInterval  time.Duration
	ContentType            string
	ResponseTopic          string
	CorrelationData        []byte
	UserProperty           map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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