Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) Connect(ctx context.Context) error
- func (c *Client) Disconnect(ctx context.Context) error
- func (c *Client) IsConnected() bool
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) PublishPayload(ctx context.Context, topic string, qos mqtt.QoSLevel, payload []byte) error
- func (c *Client) ReadNextPacket(ctx context.Context) (int, error)
- func (c *Client) SetOnPublishCallback(f func(mqtt.Header, mqtt.VariablesPublish, io.Reader) error)
- func (c *Client) Subscribe(ctx context.Context, subReq []mqtt.SubscribeRequest) error
- func (c *Client) UnsafePrepareRx(ctx context.Context) error
- func (c *Client) UnsafePrepareTx(ctx context.Context) error
- func (c *Client) UnsafeRxTx() *mqtt.RxTx
- type ClientConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotConnected = errors.New("client not connected")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client shall be safe to use concurrently between two goroutines, one reader (Rx) and one that writes (Tx).
func (*Client) Disconnect ¶
Disconnect performs a clean disconnect. If the clean disconnect fails it returns an error. Even if the clean disconnect fails and Disconnect returns error the result of IsConnected will always be false after a call to Disonnect.
func (*Client) IsConnected ¶
func (*Client) PublishPayload ¶
func (*Client) ReadNextPacket ¶ added in v0.1.2
func (*Client) SetOnPublishCallback ¶ added in v0.1.2
func (*Client) UnsafePrepareRx ¶ added in v0.1.2
Prepare Tx must be called before sending a message over the RxTx returned by UnsafeRxTx.
func (*Client) UnsafePrepareTx ¶ added in v0.1.1
Prepare Tx must be called before sending a message over the RxTx returned by UnsafeRxTx.
func (*Client) UnsafeRxTx ¶ added in v0.1.1
UnsafeRxTx returns the underyling RxTx with callback handlers and all. Not safe for concurrent use.
type ClientConfig ¶
type ClientConfig struct { // TODO(soypat): Add Will flags/fields? URL string // MQTT keepalive is amount of seconds between messages before server disconnects client automatically. MQTTKeepAlive uint16 Username, Password string WSOptions *websocket.DialOptions Subs mqtt.Subscriptions }
Click to show internal directories.
Click to hide internal directories.