Struct ntex_mqtt::v5::MqttServer
source · [−]pub struct MqttServer<St, C, Cn, P> { /* private fields */ }
Expand description
Mqtt Server
Implementations
sourceimpl<St, C> MqttServer<St, C, DefaultControlService<St, C::Error>, DefaultPublishService<St, C::Error>> where
C: ServiceFactory<Handshake, Response = HandshakeAck<St>>,
C::Error: Debug,
impl<St, C> MqttServer<St, C, DefaultControlService<St, C::Error>, DefaultPublishService<St, C::Error>> where
C: ServiceFactory<Handshake, Response = HandshakeAck<St>>,
C::Error: Debug,
sourceimpl<St, C, Cn, P> MqttServer<St, C, Cn, P> where
St: 'static,
C: ServiceFactory<Handshake, Response = HandshakeAck<St>> + 'static,
C::Error: Debug,
Cn: ServiceFactory<ControlMessage<C::Error>, Session<St>, Response = ControlResult> + 'static,
P: ServiceFactory<Publish, Session<St>, Response = PublishAck> + 'static,
impl<St, C, Cn, P> MqttServer<St, C, Cn, P> where
St: 'static,
C: ServiceFactory<Handshake, Response = HandshakeAck<St>> + 'static,
C::Error: Debug,
Cn: ServiceFactory<ControlMessage<C::Error>, Session<St>, Response = ControlResult> + 'static,
P: ServiceFactory<Publish, Session<St>, Response = PublishAck> + 'static,
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, val: Seconds) -> Self
pub fn disconnect_timeout(self, val: Seconds) -> Self
Set server 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 max_size(self, size: u32) -> Self
pub fn 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
sourcepub fn receive_max(self, val: u16) -> Self
pub fn receive_max(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.
sourcepub fn max_topic_alias(self, val: u16) -> Self
pub fn max_topic_alias(self, val: u16) -> Self
Number of topic aliases.
By default value is set to 32
sourcepub fn max_qos(self, qos: QoS) -> Self
pub fn max_qos(self, qos: QoS) -> Self
Set server max qos setting.
By default max qos is not set`
sourcepub fn max_inflight_size(self, val: usize) -> Self
pub fn max_inflight_size(self, val: usize) -> Self
Total size of in-flight messages.
By default total in-flight size is set to 64Kb
sourcepub fn control<F, Srv>(self, service: F) -> MqttServer<St, C, Srv, P> where
F: IntoServiceFactory<Srv, ControlMessage<C::Error>, Session<St>>,
Srv: ServiceFactory<ControlMessage<C::Error>, Session<St>, Response = ControlResult> + 'static,
C::Error: From<Srv::Error> + From<Srv::InitError>,
pub fn control<F, Srv>(self, service: F) -> MqttServer<St, C, Srv, P> where
F: IntoServiceFactory<Srv, ControlMessage<C::Error>, Session<St>>,
Srv: ServiceFactory<ControlMessage<C::Error>, Session<St>, Response = ControlResult> + 'static,
C::Error: From<Srv::Error> + From<Srv::InitError>,
Service to handle control packets
All control packets are processed sequentially, max number of buffered control packets is 16.
sourcepub fn publish<F, Srv>(self, publish: F) -> MqttServer<St, C, Cn, Srv> where
F: IntoServiceFactory<Srv, Publish, Session<St>>,
C::Error: From<Srv::Error> + From<Srv::InitError>,
Srv: ServiceFactory<Publish, Session<St>, Response = PublishAck> + 'static,
Srv::Error: Debug,
PublishAck: TryFrom<Srv::Error, Error = C::Error>,
pub fn publish<F, Srv>(self, publish: F) -> MqttServer<St, C, Cn, Srv> where
F: IntoServiceFactory<Srv, Publish, Session<St>>,
C::Error: From<Srv::Error> + From<Srv::InitError>,
Srv: ServiceFactory<Publish, Session<St>, Response = PublishAck> + 'static,
Srv::Error: Debug,
PublishAck: TryFrom<Srv::Error, Error = C::Error>,
Set service to handle publish packets and create mqtt server factory
sourceimpl<St, C, Cn, P> MqttServer<St, C, Cn, P> where
St: 'static,
C: ServiceFactory<Handshake, Response = HandshakeAck<St>> + 'static,
C::Error: From<Cn::Error> + From<Cn::InitError> + From<P::Error> + From<P::InitError> + Debug,
Cn: ServiceFactory<ControlMessage<C::Error>, Session<St>, Response = ControlResult> + 'static,
P: ServiceFactory<Publish, Session<St>, Response = PublishAck> + 'static,
P::Error: Debug,
PublishAck: TryFrom<P::Error, Error = C::Error>,
impl<St, C, Cn, P> MqttServer<St, C, Cn, P> where
St: 'static,
C: ServiceFactory<Handshake, Response = HandshakeAck<St>> + 'static,
C::Error: From<Cn::Error> + From<Cn::InitError> + From<P::Error> + From<P::InitError> + Debug,
Cn: ServiceFactory<ControlMessage<C::Error>, Session<St>, Response = ControlResult> + 'static,
P: ServiceFactory<Publish, Session<St>, Response = PublishAck> + 'static,
P::Error: Debug,
PublishAck: TryFrom<P::Error, Error = C::Error>,
sourcepub fn finish(
self
) -> MqttServer<Session<St>, impl ServiceFactory<IoBoxed, Response = (IoBoxed, Rc<MqttShared>, Session<St>, Seconds), Error = MqttError<C::Error>, InitError = C::InitError>, impl ServiceFactory<DispatchItem<Rc<MqttShared>>, Session<St>, Response = Option<Packet>, Error = MqttError<C::Error>, InitError = MqttError<C::Error>>, Rc<MqttShared>>
pub fn finish(
self
) -> MqttServer<Session<St>, impl ServiceFactory<IoBoxed, Response = (IoBoxed, Rc<MqttShared>, Session<St>, Seconds), Error = MqttError<C::Error>, InitError = C::InitError>, impl ServiceFactory<DispatchItem<Rc<MqttShared>>, Session<St>, Response = Option<Packet>, Error = MqttError<C::Error>, InitError = MqttError<C::Error>>, Rc<MqttShared>>
Finish server configuration and create mqtt server factory
Auto Trait Implementations
impl<St, C, Cn, P> !RefUnwindSafe for MqttServer<St, C, Cn, P>
impl<St, C, Cn, P> !Send for MqttServer<St, C, Cn, P>
impl<St, C, Cn, P> !Sync for MqttServer<St, C, Cn, P>
impl<St, C, Cn, P> Unpin for MqttServer<St, C, Cn, P> where
C: Unpin,
Cn: Unpin,
P: Unpin,
St: Unpin,
impl<St, C, Cn, P> !UnwindSafe for MqttServer<St, C, Cn, P>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more