[][src]Struct actix_mqtt_client::MqttClient

pub struct MqttClient { /* fields omitted */ }

The client for connecting to the MQTT server

Implementations

impl MqttClient[src]

pub fn new<TReader: AsyncRead + Send + 'static + Unpin, TWriter: AsyncWrite + Send + 'static + Unpin>(
    reader: TReader,
    writer: TWriter,
    client_name: String,
    options: MqttOptions,
    message_recipient: Recipient<PublishMessage>,
    error_recipient: Recipient<ErrorMessage>,
    stop_recipient: Option<Recipient<StopMessage>>
) -> Self
[src]

Create a new MQTT client

pub fn name(&self) -> &str[src]

Returns the name of the client

pub async fn connect<'_>(&'_ mut self) -> Result<(), IoError>[src]

Perform the connect operation to the remote MQTT server

Note: This function can only be called once for each client, calling it the second time will return an error Note: The successful return of this function DOES NOT mean that the MQTT connection is successful, if anything wrong happens the error actor will receive an error Note: Please use is_connected() to check whether the MQTT connection is successful or not

pub async fn is_connected<'_>(&'_ self) -> IoResult<bool>[src]

Check whether the client has connected to the server successfully

pub async fn subscribe<'_>(
    &'_ self,
    topic: String,
    qos: QualityOfService
) -> Result<(), IoError>
[src]

Subscribe to the server with a topic and QoS

pub async fn unsubscribe<'_>(&'_ self, topic: String) -> Result<(), IoError>[src]

Unsubscribe from the server

pub async fn publish<'_>(
    &'_ self,
    topic: String,
    qos: QualityOfService,
    payload: Vec<u8>
) -> Result<(), IoError>
[src]

Publish a message

pub async fn disconnect<'_>(&'_ mut self, force: bool) -> Result<(), IoError>[src]

Disconnect from the server

pub fn is_disconnected(&self) -> bool[src]

Check if the client has been disconnected from the server, useful to check whether disconnection is completed

Trait Implementations

impl Clone for MqttClient[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,