pub struct JmapEventSource { /* private fields */ }Expand description
I/O-free streaming coroutine for the JMAP EventSource push channel.
Cooperative shutdown: the coroutine polls the shared AtomicBool at the
top of each Self::resume and terminates with Complete(Ok(())) when
set. The caller’s resume loop must honour the flag too to interrupt a
blocking socket read in flight.
Implementations§
Source§impl JmapEventSource
impl JmapEventSource
Sourcepub fn subscribe_url(
session: &JmapSession,
types: &[&str],
ping_seconds: u64,
close_after: JmapCloseAfter,
) -> String
pub fn subscribe_url( session: &JmapSession, types: &[&str], ping_seconds: u64, close_after: JmapCloseAfter, ) -> String
Builds the JMAP push subscription URL: event_source_url plus
types=<csv>, closeafter=<v> (see JmapCloseAfter) and
ping=<seconds>. types may be empty for “all types”.
Sourcepub fn new(
session: &JmapSession,
http_auth: &SecretString,
types: &[&str],
ping_seconds: u64,
close_after: JmapCloseAfter,
shutdown: Arc<AtomicBool>,
) -> Result<Self, JmapEventSourceError>
pub fn new( session: &JmapSession, http_auth: &SecretString, types: &[&str], ping_seconds: u64, close_after: JmapCloseAfter, shutdown: Arc<AtomicBool>, ) -> Result<Self, JmapEventSourceError>
Builds the subscription URL from the session and prepares the initial
GET request bytes.
types filters JMAP data types (empty = all). ping_seconds sets the
server heartbeat cadence. close_after picks the lifecycle (see
JmapCloseAfter). Flip shutdown to wind the coroutine down.
Trait Implementations§
Source§impl JmapCoroutine for JmapEventSource
impl JmapCoroutine for JmapEventSource
Source§fn resume(
&mut self,
arg: Option<&[u8]>,
) -> JmapCoroutineState<Self::Yield, Self::Return>
fn resume( &mut self, arg: Option<&[u8]>, ) -> JmapCoroutineState<Self::Yield, Self::Return>
Advances the coroutine.
None on the initial call; Some(data) after a
JmapEventSourceYield::WantsRead. Some(&[]) is EOF: it’s an error
during the head stage, a clean Complete(Ok(())) during streaming.