pub struct PublishingHandler<H> { /* private fields */ }Available on crate feature
server only.Expand description
A RequestHandler that runs inner, then publishes the state
changes of its /set responses (state_change_for_response) to a
PushHub, so connections with push enabled hear about writes made
over the WebSocket without the deployment wiring it by hand.
use std::sync::Arc;
use jmap_websocket::server::{DispatcherHandler, PublishingHandler, PushHub};
use jmap_websocket::jmap_server::Dispatcher;
use jmap_websocket::jmap_types::State;
let dispatcher: Arc<Dispatcher<()>> = Arc::new(Dispatcher::new());
let hub = PushHub::new(64);
let handler = PublishingHandler::new(
DispatcherHandler::new(dispatcher, (), || State::from("s0")),
hub.clone(),
);Implementations§
Source§impl<H: RequestHandler> PublishingHandler<H>
impl<H: RequestHandler> PublishingHandler<H>
Trait Implementations§
Source§impl<H: Debug> Debug for PublishingHandler<H>
impl<H: Debug> Debug for PublishingHandler<H>
Source§impl<H: RequestHandler> RequestHandler for PublishingHandler<H>
impl<H: RequestHandler> RequestHandler for PublishingHandler<H>
Source§async fn handle(&self, request: JmapRequest) -> Result<JmapResponse, JmapError>
async fn handle(&self, request: JmapRequest) -> Result<JmapResponse, JmapError>
Process one parsed Request.
Err is a request-level error (RFC
8620 §3.6.1, e.g. unknownCapability) and is sent as a
RequestError; method-level errors belong in the Response.Source§fn prepare_problem(&self, problem: &mut ProblemDetails)
fn prepare_problem(&self, problem: &mut ProblemDetails)
Called on every RequestError before it is sent, including those
the driver makes itself. Set a localized
title here (RFC 9457
§3.1.3); the default leaves the problem as it is.Auto Trait Implementations§
impl<H> Forget for PublishingHandler<H>
impl<H> Freeze for PublishingHandler<H>where
H: Freeze,
impl<H> Move for PublishingHandler<H>
impl<H> RefUnwindSafe for PublishingHandler<H>where
H: RefUnwindSafe,
impl<H> Send for PublishingHandler<H>where
H: Send,
impl<H> Sync for PublishingHandler<H>where
H: Sync,
impl<H> Unpin for PublishingHandler<H>where
H: Unpin,
impl<H> UnsafeUnpin for PublishingHandler<H>where
H: UnsafeUnpin,
impl<H> UnwindSafe for PublishingHandler<H>where
H: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more