Struct engineioxide::service::EngineIoService
source · pub struct EngineIoService<H: EngineIoHandler, S = NotFoundService> { /* private fields */ }Expand description
A [Service] that handles EngineIo requests as a middleware.
If the request is not an EngineIo request, it forwards it to the inner service.
It is agnostic to the TransportType.
By default, it uses a NotFoundService as the inner service so it can be used as a standalone [Service].
Implementations§
source§impl<H: EngineIoHandler> EngineIoService<H, NotFoundService>
impl<H: EngineIoHandler> EngineIoService<H, NotFoundService>
sourcepub fn new(handler: H) -> Self
pub fn new(handler: H) -> Self
Create a new EngineIoService with a NotFoundService as the inner service.
If the request is not an EngineIo request, it will always return a 404 response.
sourcepub fn with_config(handler: H, config: EngineIoConfig) -> Self
pub fn with_config(handler: H, config: EngineIoConfig) -> Self
Create a new EngineIoService with a custom config
source§impl<S: Clone, H: EngineIoHandler> EngineIoService<H, S>
impl<S: Clone, H: EngineIoHandler> EngineIoService<H, S>
sourcepub fn with_inner(inner: S, handler: H) -> Self
pub fn with_inner(inner: S, handler: H) -> Self
Create a new EngineIoService with a custom inner service.
sourcepub fn with_config_inner(inner: S, handler: H, config: EngineIoConfig) -> Self
pub fn with_config_inner(inner: S, handler: H, config: EngineIoConfig) -> Self
Create a new EngineIoService with a custom inner service and a custom config.
sourcepub fn into_make_service(self) -> MakeEngineIoService<H, S>
pub fn into_make_service(self) -> MakeEngineIoService<H, S>
Convert this EngineIoService into a MakeEngineIoService.
This is useful when using EngineIoService without layers.
Trait Implementations§
source§impl<S: Clone, H: EngineIoHandler> Clone for EngineIoService<H, S>
impl<S: Clone, H: EngineIoHandler> Clone for EngineIoService<H, S>
source§impl<H: EngineIoHandler, S> Debug for EngineIoService<H, S>
impl<H: EngineIoHandler, S> Debug for EngineIoService<H, S>
source§impl<ReqBody, ResBody, S, H> Service<Request<ReqBody>> for EngineIoService<H, S>
impl<ReqBody, ResBody, S, H> Service<Request<ReqBody>> for EngineIoService<H, S>
The service implementation for EngineIoService.
source§fn call(&mut self, req: Request<ReqBody>) -> Self::Future
fn call(&mut self, req: Request<ReqBody>) -> Self::Future
Handle the request.
Each request is parsed to extract the TransportType and the socket id.
If the request is an EngineIo request, it is handled by the EngineIo engine.
Otherwise, it is forwarded to the inner service.