Documentation
¶
Overview ¶
Package smqtt implements functions for manipulation of MQTT API. It provides a gin-like way to create MQTT API.
Package smqtt implements functions for manipulation of MQTT API. It provides a gin-like way to create MQTT API.
Package smqtt implements functions for manipulation of MQTT API. It provides a gin-like way to create MQTT API.
Package smqtt implements functions for manipulation of MQTT API. It provides a gin-like way to create MQTT API.
Index ¶
- func ClientError(err_str string) error
- func InternalError(err_str string) error
- func ParamRequiredError(param_name string) error
- func SessionID() string
- type Cache
- type ClientConfig
- type Config
- type Context
- func (c *Context) Abort()
- func (c *Context) BindJSON(obj interface{}) error
- func (c *Context) Get(key string) (value interface{}, exists bool)
- func (c *Context) MustGet(key string) interface{}
- func (c *Context) Next()
- func (c *Context) Payload() []byte
- func (c *Context) Qos() byte
- func (c *Context) Respond(topic string, qos byte, retained bool, msg []byte) error
- func (c *Context) Session() string
- func (c *Context) Set(key string, value interface{})
- func (c *Context) Start()
- func (c *Context) Topic() string
- type Group
- type Handler
- type Response
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientError ¶
func InternalError ¶
func ParamRequiredError ¶
Types ¶
type ClientConfig ¶
type Config ¶
type Config struct { Name string Dedup bool Prefix string Expiration int Client *ClientConfig }
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context allows us to pass variables between middleware, manage the flow, validate the JSON of a MQTT Message and render a JSON response.
func (*Context) Abort ¶
func (c *Context) Abort()
Abort is used to abort the execution of context.handlers.
func (*Context) MustGet ¶
MustGet returns the value for the given key if it existes, otherwise it panics.
func (*Context) Next ¶
func (c *Context) Next()
Next is used to execute context.handlers[context.index+1:]
func (*Context) Respond ¶
Respond is used to write and send a MQTT message to certain topic as response
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group allows us to create MQTT API and manipulate them as a group.
type Handler ¶
type Handler func(*Context)
This definition indicates that a handler implementaion must and only has a *Context as parameter
type Response ¶
When a response is rendered using context.Respond, it will be recorded in context.keys in the form of Response.