pub struct MqttConnector<A, T> { /* private fields */ }Expand description
Mqtt client connector
Implementations§
Source§impl<A> MqttConnector<A, ()>
impl<A> MqttConnector<A, ()>
Sourcepub fn new(address: A) -> MqttConnector<A, Connector<A>>
pub fn new(address: A) -> MqttConnector<A, Connector<A>>
Create new mqtt connector
Source§impl<A, T> MqttConnector<A, T>
impl<A, T> MqttConnector<A, T>
Sourcepub fn client_id<U>(self, client_id: U) -> Selfwhere
ByteString: From<U>,
pub fn client_id<U>(self, client_id: U) -> Selfwhere
ByteString: From<U>,
Create new client and provide client id
Sourcepub fn clean_session(self) -> Self
pub fn clean_session(self) -> Self
The handling of the Session state.
Sourcepub fn keep_alive(self, val: Seconds) -> Self
pub fn keep_alive(self, val: Seconds) -> Self
A time interval measured in seconds.
keep-alive is set to 30 seconds by default.
Sourcepub fn last_will(self, val: LastWill) -> Self
pub fn last_will(self, val: LastWill) -> Self
Will Message be stored on the Server and associated with the Network Connection.
by default last will value is not set
Sourcepub fn username<U>(self, val: U) -> Selfwhere
ByteString: From<U>,
pub fn username<U>(self, val: U) -> Selfwhere
ByteString: From<U>,
Username can be used by the Server for authentication and authorization.
Sourcepub fn password(self, val: Bytes) -> Self
pub fn password(self, val: Bytes) -> Self
Password can be used by the Server for authentication and authorization.
Sourcepub fn max_size(self, val: u32) -> Self
pub fn max_size(self, val: u32) -> Self
Max incoming packet size.
To disable max size limit set value to 0.
Sourcepub fn max_send(self, val: u16) -> Self
pub fn max_send(self, val: u16) -> Self
Set max send packets number
Number of in-flight outgoing publish packets. By default send max is set to 16 packets. To disable in-flight limit set value to 0.
Sourcepub fn max_receive(self, val: u16) -> Self
pub fn max_receive(self, val: u16) -> Self
Number of inbound in-flight concurrent messages.
By default inbound is set to 16 messages To disable in-flight limit set value to 0.
Sourcepub fn min_chunk_size(self, size: u32) -> Self
pub fn min_chunk_size(self, size: u32) -> Self
Set min payload chunk size.
If the minimum size is set to 0, incoming payload chunks
will be processed immediately. Otherwise, the codec will
accumulate chunks until the total size reaches the specified minimum.
By default min size is set to 0
Sourcepub fn handshake_timeout(self, timeout: Seconds) -> Self
pub fn handshake_timeout(self, timeout: Seconds) -> Self
Set handshake timeout.
Handshake includes connect packet and response connect-ack.
By default handshake timeuot is disabled.
Sourcepub fn disconnect_timeout(self, timeout: Seconds) -> Self
pub fn disconnect_timeout(self, timeout: Seconds) -> Self
Set client connection disconnect timeout.
Defines a timeout for disconnect connection. If a disconnect procedure does not complete within this time, the connection get dropped.
To disable timeout set value to 0.
By default disconnect timeout is set to 3 seconds.
Sourcepub fn memory_pool(self, id: PoolId) -> Self
pub fn memory_pool(self, id: PoolId) -> Self
Set memory pool.
Use specified memory pool for memory allocations. By default P5 memory pool is used.
Sourcepub fn connector<U, F>(self, connector: F) -> MqttConnector<A, U>where
F: IntoService<U, Connect<A>>,
U: Service<Connect<A>, Error = ConnectError>,
IoBoxed: From<U::Response>,
pub fn connector<U, F>(self, connector: F) -> MqttConnector<A, U>where
F: IntoService<U, Connect<A>>,
U: Service<Connect<A>, Error = ConnectError>,
IoBoxed: From<U::Response>,
Use custom connector
Source§impl<A, T> MqttConnector<A, T>
impl<A, T> MqttConnector<A, T>
Sourcepub async fn connect(&self) -> Result<Client, ClientError<ConnectAck>>
pub async fn connect(&self) -> Result<Client, ClientError<ConnectAck>>
Connect to mqtt server