MqttServiceConfig

Struct MqttServiceConfig 

Source
pub struct MqttServiceConfig { /* private fields */ }

Implementations§

Source§

impl MqttServiceConfig

Source

pub fn new() -> Self

Source

pub fn protocol_version_timeout(self, timeout: Seconds) -> Self

Set client timeout reading protocol version.

Defines a timeout for reading protocol version. If a client does not transmit version of the protocol within this time, the connection is terminated with Mqtt::Handshake(HandshakeError::Timeout) error.

By default, timeuot is 5 seconds.

Source

pub fn set_connect_timeout(self, timeout: Seconds) -> Self

Set client timeout for first Connect frame.

Defines a timeout for reading Connect frame. If a client does not transmit the entire frame within this time, the connection is terminated with Mqtt::Handshake(HandshakeError::Timeout) error.

By default, connect timeout is disabled.

Source

pub fn set_max_qos(self, qos: QoS) -> Self

Set max allowed QoS.

If peer sends publish with higher qos then ProtocolError::MaxQoSViolated(..) By default max qos is set to ExactlyOnce.

Source

pub fn set_max_size(self, size: u32) -> Self

Set max inbound frame size.

If max size is set to 0, size is unlimited. By default max size is set to 0

Source

pub fn set_max_receive(self, val: u16) -> Self

Set receive max

Number of in-flight publish packets. By default receive max is set to 15 packets. To disable timeout set value to 0.

Source

pub fn set_max_receive_size(self, val: usize) -> Self

Total size of received in-flight messages.

By default total in-flight size is set to 64Kb

Source

pub fn set_max_topic_alias(self, val: u16) -> Self

Number of topic aliases.

By default value is set to 32

Source

pub fn set_max_send(self, val: u16) -> Self

Number of outgoing concurrent messages.

By default outgoing is set to 16 messages

Source

pub fn set_max_send_size(self, val: u32) -> Self

Total size of outgoing messages.

By default total outgoing size is set to 64Kb

Source

pub fn set_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

Source

pub fn set_handle_qos_after_disconnect( self, max_handle_qos: Option<QoS>, ) -> Self

Handle max received QoS messages after client disconnect.

By default, messages received before dispatched to the publish service will be dropped if the client disconnect is detected on the server.

If this option is set to Some(QoS::AtMostOnce), only the received QoS 0 messages will always be handled by the server’s publish service no matter if the client is disconnected or not.

If this option is set to Some(QoS::AtLeastOnce), the received QoS 0 and QoS 1 messages will always be handled by the server’s publish service no matter if the client is disconnected or not. The QoS 2 messages will be dropped if the client disconnecting is detected before the server dispatches them to the publish service.

If this option is set to Some(QoS::ExactlyOnce), all the messages received will always be handled by the server’s publish service no matter if the client is disconnected or not.

The received messages which QoS larger than the max_handle_qos will not be guaranteed to be handled or not after the client disconnect. It depends on the network condition.

By default handle-qos-after-disconnect is set to None

Source

pub fn set_handshake_timeout(self, timeout: Seconds) -> Self

Set handshake timeout.

Handshake includes connect packet and response connect-ack. By default handshake timeuot is disabled.

Trait Implementations§

Source§

impl Clone for MqttServiceConfig

Source§

fn clone(&self) -> MqttServiceConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Configuration for MqttServiceConfig

Source§

const NAME: &str = "MQTT Service configuration"

Source§

fn ctx(&self) -> &CfgContext

Source§

fn set_ctx(&mut self, ctx: CfgContext)

Source§

impl Debug for MqttServiceConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MqttServiceConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for MqttServiceConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.