Documentation
¶
Index ¶
- Constants
- Variables
- func AllowHook(ms *MqttServer) error
- func AppendHooks(ms *MqttServer, hooks ...mqtt.Hook) error
- func AppendListeners(ms *MqttServer, listeners ...listeners.Listener) error
- func Module(opts ...di.Node) di.Node
- type Authorizer
- type MqttServer
- type Server
- type Websocket
- func (l *Websocket) Address() string
- func (l *Websocket) Close(closeClients listeners.CloseFn)
- func (l *Websocket) Handle(r fiber.Router)
- func (l *Websocket) ID() string
- func (l *Websocket) Init(log *slog.Logger) error
- func (l *Websocket) Protocol() string
- func (l *Websocket) Serve(establish listeners.EstablishFn)
Constants ¶
View Source
const TypeWS = "ws"
Variables ¶
View Source
var ( // ErrInvalidMessage indicates that a message payload was not valid. ErrInvalidMessage = errors.New("message type not binary") )
View Source
var HooksGroupName = "mqtt_hooks"
View Source
var ListenersGroupName = "mqtt_listeners"
Functions ¶
func AllowHook ¶
func AllowHook(ms *MqttServer) error
func AppendHooks ¶
func AppendHooks(ms *MqttServer, hooks ...mqtt.Hook) error
func AppendListeners ¶
func AppendListeners(ms *MqttServer, listeners ...listeners.Listener) error
Types ¶
type Authorizer ¶
func NewAuthorizer ¶
func NewAuthorizer(logger *zap.Logger) Authorizer
type MqttServer ¶
func NewMqttServer ¶
func NewMqttServer() (*MqttServer, error)
type Websocket ¶
Websocket is a listener for establishing websocket connections.
func NewWebsocket ¶
func NewWebsocket(app fiber.Router, authorizer Authorizer) *Websocket
NewWebsocket initializes and returns a new Websocket listener, listening on an address.
func (*Websocket) Serve ¶
func (l *Websocket) Serve(establish listeners.EstablishFn)
Serve starts waiting for new Websocket connections, and calls the connection establishment callback for any received.
Click to show internal directories.
Click to hide internal directories.