Documentation
¶
Index ¶
- Constants
- func NewClientOptions(brokerURL, clientIDPrefix string) *mqtt.ClientOptions
- func ParseMQTTPath(path string) (broker, topic string, err error)
- type ClientFactory
- type MQTTProtocolInfo
- type Reader
- func (*Reader) CancelWrite()
- func (*Reader) Capabilities() []readers.Capability
- func (r *Reader) Close() error
- func (r *Reader) Connected() bool
- func (*Reader) Detect(_ []string) string
- func (*Reader) IDs() []string
- func (r *Reader) Info() string
- func (*Reader) Metadata() readers.DriverMetadata
- func (*Reader) OnMediaChange(*models.ActiveMedia) error
- func (r *Reader) Open(device config.ReadersConnect, scanQueue chan<- readers.Scan, ...) error
- func (r *Reader) Path() string
- func (r *Reader) ReaderID() string
- func (*Reader) Write(_ string) (*tokens.Token, error)
Constants ¶
View Source
const TokenType = "mqtt"
Variables ¶
This section is empty.
Functions ¶
func NewClientOptions ¶
func NewClientOptions(brokerURL, clientIDPrefix string) *mqtt.ClientOptions
NewClientOptions creates and configures MQTT client options based on a broker URL. The clientIDPrefix is used to generate a unique client ID (e.g., "zaparoo-mqtt-" or "zaparoo-publisher-").
func ParseMQTTPath ¶
ParseMQTTPath parses an MQTT connection path in the format "broker:port/topic" and returns the broker address and topic separately.
Examples:
- "localhost:1883/zaparoo/tokens" -> ("localhost:1883", "zaparoo/tokens")
- "mqtt.example.com:8883/home/zaparoo" -> ("mqtt.example.com:8883", "home/zaparoo")
Types ¶
type ClientFactory ¶
type ClientFactory func(opts *mqtt.ClientOptions) mqtt.Client
ClientFactory creates MQTT clients. This interface allows for testing by injecting mock clients.
var DefaultClientFactory ClientFactory = mqtt.NewClient
DefaultClientFactory is the standard factory that creates real MQTT clients.
type MQTTProtocolInfo ¶
MQTTProtocolInfo contains parsed MQTT protocol information.
func ParseMQTTProtocol ¶
func ParseMQTTProtocol(urlStr string) MQTTProtocolInfo
ParseMQTTProtocol extracts protocol information from an MQTT URL string.
Examples:
- "mqtts://broker:8883" -> {Protocol: "ssl", UseTLS: true, Scheme: "mqtts", Remainder: "broker:8883"}
- "ssl://broker:8883" -> {Protocol: "ssl", UseTLS: true, Scheme: "ssl", Remainder: "broker:8883"}
- "mqtt://broker:1883" -> {Protocol: "tcp", UseTLS: false, Scheme: "mqtt", Remainder: "broker:1883"}
- "broker:1883" -> {Protocol: "tcp", UseTLS: false, Scheme: "", Remainder: "broker:1883"}
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func (*Reader) CancelWrite ¶
func (*Reader) CancelWrite()
func (*Reader) Capabilities ¶
func (*Reader) Capabilities() []readers.Capability
func (*Reader) Metadata ¶
func (*Reader) Metadata() readers.DriverMetadata
func (*Reader) OnMediaChange ¶
func (*Reader) OnMediaChange(*models.ActiveMedia) error
Click to show internal directories.
Click to hide internal directories.