http2mqtt

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MaxClientIdLen = 14

Variables

This section is empty.

Functions

This section is empty.

Types

type Http2Mqtt

type Http2Mqtt struct {
	Router        *gin.Engine
	Group         *gin.RouterGroup
	MqttBrokerURL string
	// contains filtered or unexported fields
}

func New

func New(mqttOpts *MQTT.ClientOptions, opts ...Http2MqttOption) *Http2Mqtt

func (*Http2Mqtt) EnableProfiling

func (h *Http2Mqtt) EnableProfiling(enable bool)

func (*Http2Mqtt) EnableStream

func (h *Http2Mqtt) EnableStream(status bool)

func (*Http2Mqtt) GetMqttClient

func (h *Http2Mqtt) GetMqttClient() *MQTT.Client

func (*Http2Mqtt) GetStreamChannel

func (h *Http2Mqtt) GetStreamChannel() chan MQTT.Message

func (*Http2Mqtt) GetSubscriptions

func (h *Http2Mqtt) GetSubscriptions() []SubScribeMessage

func (*Http2Mqtt) Run

func (h *Http2Mqtt) Run(addrHttp string)

func (*Http2Mqtt) SetGinAuth

func (s *Http2Mqtt) SetGinAuth(user string, password string)

func (*Http2Mqtt) SetStreamChannel

func (h *Http2Mqtt) SetStreamChannel(ch chan MQTT.Message)

func (*Http2Mqtt) SubscribeTopic

func (m *Http2Mqtt) SubscribeTopic(msg SubScribeMessage) error

type Http2MqttOption

type Http2MqttOption func(*Http2Mqtt)

func WithOptionPrefix

func WithOptionPrefix(prefix string) Http2MqttOption

func WithOptionRouter

func WithOptionRouter(router *gin.Engine) Http2MqttOption

func WithOptionRouterGroup

func WithOptionRouterGroup(group *gin.RouterGroup) Http2MqttOption

type PublishMessage

type PublishMessage struct {
	Topic    string          `binding:"required" json:"topic"`
	Message  json.RawMessage `binding:"required" json:"data"`
	Qos      byte            `json:"qos"`
	Retained bool            `json:"retained"`
}

PublishMessage is the sample data transfer object for publish http route

type SubScribeMessage

type SubScribeMessage struct {
	Topic string `binding:"required" json:"topic"`
	Qos   byte   `json:"qos"`
}

type WsHandler

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

Jump to

Keyboard shortcuts

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