Struct mosquitto_client::Mosquitto[][src]

pub struct Mosquitto { /* fields omitted */ }

Mosquitto client

Methods

impl Mosquitto
[src]

create a new mosquitto instance, providing a client name. Clients connecting to a broker must have unique names

create a new mosquitto instance with specified clean session flag. Clients connecting to a broker must have unique names

create a Callback object so you can listen to events.

connect to the broker. You can only be fully sure that a connection succeeds after the on_connect callback returns non-zero

connect to the broker, waiting for success.

call if you wish to use Mosquitto in a multithreaded environment.

reconnect to the broker

subscribe to an MQTT topic, with a desired quality-of-service. The returned value can be used to directly match against received messages, and has a mid field identifying the subscribing request. on_subscribe will be called with this identifier.

unsubcribe from an MQTT topic - on_unsubscribe callback will be called.

publish an MQTT message to the broker, returning message id. Quality-of-service and whether retained can be specified. To be sure, check the message id passed to the on_publish callback

publish an MQTT message to the broker, returning message id after waiting for successful publish

explicitly disconnect from the broker.

process network events for at most timeout milliseconds. -1 will mean the default, 1000ms.

process network events. This will handle intermittent disconnects for you, but will return after an explicit disconnect() call

loop forever, but do not regard an explicit disconnect as an error.

Set TLS parameters cafile is a file containing the PEM encoded trusted CA certificate certfile is a file containing the PEM encoded certificate file for this client. keyfile is a file containing the PEM encoded private key for this client. password if the private key is encrypted

Set TLS PSK parameters psk is the pre-shared-key in hex format with no leading "0x" identity is the identity of this client. May be used as the username ciphers is an optional string describing the PSK ciphers available for use

Trait Implementations

impl Send for Mosquitto
[src]

impl Sync for Mosquitto
[src]

impl Clone for Mosquitto
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Drop for Mosquitto
[src]

Executes the destructor for this type. Read more