[−][src]Struct actix_mqtt_client::MqttClient
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]
reader: TReader,
writer: TWriter,
client_name: String,
options: MqttOptions,
message_recipient: Recipient<PublishMessage>,
error_recipient: Recipient<ErrorMessage>,
stop_recipient: Option<Recipient<StopMessage>>
) -> Self
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]
&'_ self,
topic: String,
qos: QualityOfService
) -> Result<(), IoError>
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]
&'_ self,
topic: String,
qos: QualityOfService,
payload: Vec<u8>
) -> Result<(), IoError>
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]
fn clone(&self) -> MqttClient[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Auto Trait Implementations
impl !RefUnwindSafe for MqttClient
impl Send for MqttClient
impl Sync for MqttClient
impl Unpin for MqttClient
impl !UnwindSafe for MqttClient
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,