Struct ntex_mqtt::v5::client::MqttConnector

source ·
pub struct MqttConnector<A, T> { /* private fields */ }
Expand description

Mqtt client connector

Implementations§

source§

impl<A> MqttConnector<A, ()>
where A: Address + Clone,

source

pub fn new(address: A) -> MqttConnector<A, Connector<A>>

Create new mqtt connector

source§

impl<A, T> MqttConnector<A, T>
where A: Address + Clone,

source

pub fn client_id<U>(self, client_id: U) -> Self
where ByteString: From<U>,

Create new client and provide client id

source

pub fn clean_start(self) -> Self

The handling of the Session state.

source

pub fn keep_alive(self, val: Seconds) -> Self

A time interval measured in seconds.

keep-alive is set to 30 seconds by default.

source

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

source

pub fn auth(self, method: ByteString, data: Bytes) -> Self

Set auth-method and auth-data for connect packet.

source

pub fn username(self, val: ByteString) -> Self

Username can be used by the Server for authentication and authorization.

source

pub fn password(self, val: Bytes) -> Self

Password can be used by the Server for authentication and authorization.

source

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

Max incoming packet size.

To disable max size limit set value to 0.

source

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

Set receive max

Number of in-flight incoming publish packets. By default receive max is set to 16 packets. To disable in-flight limit set value to 0.

source

pub fn properties<F>(self, f: F) -> Self
where F: FnOnce(&mut UserProperties),

Update connect user properties

source

pub fn packet<F>(self, f: F) -> Self
where F: FnOnce(&mut Connect),

Update connect packet

source

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.

source

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.

source

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.

source

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>
where A: Address + Clone, T: Service<Connect<A>, Error = ConnectError>, IoBoxed: From<T::Response>,

source

pub async fn connect(&self) -> Result<Client, ClientError<Box<ConnectAck>>>

Connect to mqtt server

Auto Trait Implementations§

§

impl<A, T> !Freeze for MqttConnector<A, T>

§

impl<A, T> !RefUnwindSafe for MqttConnector<A, T>

§

impl<A, T> !Send for MqttConnector<A, T>

§

impl<A, T> !Sync for MqttConnector<A, T>

§

impl<A, T> Unpin for MqttConnector<A, T>
where A: Unpin,

§

impl<A, T> !UnwindSafe for MqttConnector<A, T>

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more