Documentation
¶
Overview ¶
Package gateway provides a pico-cs MQTT broker gateway.
Index ¶
- Constants
- func CheckLevelName(name string) error
- type Config
- type Gateway
- func (gw *Gateway) Close() error
- func (gw *Gateway) Listen() error
- func (gw *Gateway) Publish(topicStrs []string, retain bool, value any)
- func (gw *Gateway) PublishErr(topicStrs []string, retain bool, err error)
- func (gw *Gateway) Subscribe(hndCh chan<- *HndMsg, owner any, topicStrs []string, fn HndFn)
- func (gw *Gateway) Unsubscribe(owner any, topicStrs []string)
- type HndFn
- type HndMsg
Constants ¶
View Source
const ( DefaultTopicRoot = "pico-cs" DefaultHost = "localhost" DefaultPort = "1883" )
Default values.
View Source
const DefChanSize = 100
DefChanSize defines the default channel size.
Variables ¶
This section is empty.
Functions ¶
func CheckLevelName ¶
CheckLevelName checks if topic level name consists of valid characters.
Types ¶
type Config ¶
type Config struct {
// root part of all gateway MQTT topics
TopicRoot string
// MQTT broker host
Host string
// MQTT broker port
Port string
// MQTT authentication username
Username string
// MQTT authentication password
Password string
}
Config represents mqtt configuration data for the gateway.
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway represents a MQTT broker gateway.
func (*Gateway) PublishErr ¶
PublishErr publishes a error message
func (*Gateway) Unsubscribe ¶
Unsubscribe unsubscribes a message handler.
Click to show internal directories.
Click to hide internal directories.