pub struct MqttOptions { /* private fields */ }
Expand description
Options to configure the behaviour of mqtt connection
Implementations§
Source§impl MqttOptions
impl MqttOptions
Sourcepub fn new<S: Into<String>, T: Into<String>>(
id: S,
host: T,
port: u16,
) -> MqttOptions
pub fn new<S: Into<String>, T: Into<String>>( id: S, host: T, port: u16, ) -> MqttOptions
New mqtt options
Sourcepub fn broker_address(&self) -> (String, u16)
pub fn broker_address(&self) -> (String, u16)
Broker address
pub fn set_last_will(&mut self, will: LastWill) -> &mut Self
pub fn last_will(&mut self) -> Option<LastWill>
pub fn set_ca(&mut self, ca: Vec<u8>) -> &mut Self
pub fn ca(&self) -> Option<Vec<u8>>
pub fn set_client_auth(&mut self, cert: Vec<u8>, key: Vec<u8>) -> &mut Self
pub fn client_auth(&self) -> Option<(Vec<u8>, Vec<u8>)>
pub fn set_alpn(&mut self, alpn: Vec<Vec<u8>>) -> &mut Self
pub fn alpn(&self) -> Option<Vec<Vec<u8>>>
Sourcepub fn set_keep_alive(&mut self, secs: u16) -> &mut Self
pub fn set_keep_alive(&mut self, secs: u16) -> &mut Self
Set number of seconds after which client should ping the broker if there is no other data exchange
Sourcepub fn keep_alive(&self) -> Duration
pub fn keep_alive(&self) -> Duration
Keep alive time
Sourcepub fn set_max_packet_size(&mut self, sz: usize) -> &mut Self
pub fn set_max_packet_size(&mut self, sz: usize) -> &mut Self
Set packet size limit (in Kilo Bytes)
Sourcepub fn max_packet_size(&self) -> usize
pub fn max_packet_size(&self) -> usize
Maximum packet size
Sourcepub fn set_clean_session(&mut self, clean_session: bool) -> &mut Self
pub fn set_clean_session(&mut self, clean_session: bool) -> &mut Self
clean_session = true
removes all the state from queues & instructs the broker
to clean all the client state when client disconnects.
When set false
, broker will hold the client state and performs pending
operations on the client when reconnection with same client_id
happens. Local queue state is also held to retransmit packets after reconnection.
Sourcepub fn clean_session(&self) -> bool
pub fn clean_session(&self) -> bool
Clean session
Sourcepub fn set_credentials<S: Into<String>>(
&mut self,
username: S,
password: S,
) -> &mut Self
pub fn set_credentials<S: Into<String>>( &mut self, username: S, password: S, ) -> &mut Self
Username and password
Sourcepub fn credentials(&self) -> Option<(String, String)>
pub fn credentials(&self) -> Option<(String, String)>
Security options
Sourcepub fn set_notification_channel_capacity(
&mut self,
capacity: usize,
) -> &mut Self
pub fn set_notification_channel_capacity( &mut self, capacity: usize, ) -> &mut Self
Set notification channel capacity
Sourcepub fn notification_channel_capacity(&self) -> usize
pub fn notification_channel_capacity(&self) -> usize
Notification channel capacity
Sourcepub fn set_request_channel_capacity(&mut self, capacity: usize) -> &mut Self
pub fn set_request_channel_capacity(&mut self, capacity: usize) -> &mut Self
Set request channel capacity
Sourcepub fn request_channel_capacity(&self) -> usize
pub fn request_channel_capacity(&self) -> usize
Request channel capacity
Sourcepub fn set_throttle(&mut self, duration: Duration) -> &mut Self
pub fn set_throttle(&mut self, duration: Duration) -> &mut Self
Enables throttling and sets outoing message rate to the specified ‘rate’
Sourcepub fn set_inflight(&mut self, inflight: usize) -> &mut Self
pub fn set_inflight(&mut self, inflight: usize) -> &mut Self
Set number of concurrent in flight messages
Trait Implementations§
Source§impl Clone for MqttOptions
impl Clone for MqttOptions
Source§fn clone(&self) -> MqttOptions
fn clone(&self) -> MqttOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more