broker

package
v0.0.0-...-0446ca0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker struct {
	MessageEvent chan interface{}
	// contains filtered or unexported fields
}

func NewBroker

func NewBroker(addr string) *Broker

func (*Broker) ListenAndServe

func (b *Broker) ListenAndServe(ctx context.Context) error

func (*Broker) Publish

func (b *Broker) Publish(pb *message.Publish)

type Client

type Client struct {
	Publisher chan *message.Publish
	// contains filtered or unexported fields
}

func NewClient

func NewClient(conn net.Conn, info message.Connect, ctx context.Context, b *Broker) *Client

func (*Client) Close

func (c *Client) Close(isWill bool)

func (*Client) Closed

func (c *Client) Closed() <-chan struct{}

func (*Client) Id

func (c *Client) Id() string

type Subscription

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

func NewSubscription

func NewSubscription() *Subscription

func (*Subscription) CompileTopicRegex

func (s *Subscription) CompileTopicRegex(topic string) (*regexp.Regexp, error)

func (*Subscription) FindTopics

func (s *Subscription) FindTopics(topic string) ([]string, error)

func (*Subscription) GetClientsByTopic

func (s *Subscription) GetClientsByTopic(topic string) *SubscriptionInfo

func (*Subscription) Subscribe

func (s *Subscription) Subscribe(clientId string, t message.SubscribeTopic) (message.ReasonCode, error)

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe(clientId, topic string)

func (*Subscription) UnsubscribeAll

func (s *Subscription) UnsubscribeAll(clientId string)

type SubscriptionInfo

type SubscriptionInfo struct {
	Clients       map[string]message.QoSLevel
	RetainMessage *message.Publish
}

Jump to

Keyboard shortcuts

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