pub struct MqttServer<St, C, Cn, M = Identity> { /* private fields */ }Expand description
Mqtt Server
Implementations§
Source§impl<St, C, Cn, M> MqttServer<St, C, Cn, M>where
St: 'static,
C: ServiceFactory<Handshake, SharedCfg, Response = HandshakeAck<St>> + 'static,
C::Error: Debug,
Cn: ServiceFactory<Control<C::Error>, Session<St>, Response = ControlAck> + 'static,
impl<St, C, Cn, M> MqttServer<St, C, Cn, M>where
St: 'static,
C: ServiceFactory<Handshake, SharedCfg, Response = HandshakeAck<St>> + 'static,
C::Error: Debug,
Cn: ServiceFactory<Control<C::Error>, Session<St>, Response = ControlAck> + 'static,
Sourcepub fn reset_middlewares(self) -> MqttServer<St, C, Cn, Identity>
pub fn reset_middlewares(self) -> MqttServer<St, C, Cn, Identity>
Remove all middlewares
Sourcepub fn middleware<U>(self, mw: U) -> MqttServer<St, C, Cn, Stack<M, U>>
pub fn middleware<U>(self, mw: U) -> MqttServer<St, C, Cn, Stack<M, U>>
Registers middleware, in the form of a middleware component (type), that runs during inbound and/or outbound processing in the request lifecycle (request -> response), modifying request/response as necessary, across all requests managed by the Server.
Use middleware when you need to read or modify every request or response in some way.
Sourcepub fn control<F, Srv>(self, service: F) -> MqttServer<St, C, Srv, M>where
F: IntoServiceFactory<Srv, Control<C::Error>, Session<St>>,
Srv: ServiceFactory<Control<C::Error>, Session<St>, Response = ControlAck> + 'static,
C::Error: From<Srv::Error> + From<Srv::InitError>,
pub fn control<F, Srv>(self, service: F) -> MqttServer<St, C, Srv, M>where
F: IntoServiceFactory<Srv, Control<C::Error>, Session<St>>,
Srv: ServiceFactory<Control<C::Error>, Session<St>, Response = ControlAck> + '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<Session<St>, impl ServiceFactory<IoBoxed, SharedCfg, Response = (IoBoxed, Rc<MqttShared>, Session<St>, Seconds), Error = MqttError<C::Error>, InitError = C::InitError>, impl ServiceFactory<DispatchItem<Rc<MqttShared>>, (SharedCfg, Session<St>), Response = Option<Encoded>, Error = MqttError<C::Error>, InitError = MqttError<C::Error>>, M, Rc<MqttShared>>
pub fn publish<F, Srv>( self, publish: F, ) -> MqttServer<Session<St>, impl ServiceFactory<IoBoxed, SharedCfg, Response = (IoBoxed, Rc<MqttShared>, Session<St>, Seconds), Error = MqttError<C::Error>, InitError = C::InitError>, impl ServiceFactory<DispatchItem<Rc<MqttShared>>, (SharedCfg, Session<St>), Response = Option<Encoded>, Error = MqttError<C::Error>, InitError = MqttError<C::Error>>, M, Rc<MqttShared>>
Set service to handle publish packets and create mqtt server factory and create mqtt server factory