pub trait ChatWsExt: Sealed {
// Required methods
fn next_chat_frame(
&mut self,
) -> impl Future<Output = Option<Result<ChatWsFrame, ClientError>>> + Send;
fn send_stream_enable(
&mut self,
enable: &ChatStreamEnable,
) -> impl Future<Output = Result<(), ClientError>> + Send;
fn send_stream_disable(
&mut self,
) -> impl Future<Output = Result<(), ClientError>> + Send;
}Expand description
Extension trait adding JMAP Chat ephemeral-event methods to WsSession.
Import this trait to use: use jmap_chat_client::ChatWsExt;
This trait is sealed: implementations outside this crate are not
permitted. The crate adds an impl only for
jmap_base_client::WsSession. Sealing prevents downstream
divergence and keeps adding methods to the trait a non-breaking
change.
Required Methods§
Sourcefn next_chat_frame(
&mut self,
) -> impl Future<Output = Option<Result<ChatWsFrame, ClientError>>> + Send
fn next_chat_frame( &mut self, ) -> impl Future<Output = Option<Result<ChatWsFrame, ClientError>>> + Send
Receive the next frame from the server, interpreted as a ChatWsFrame.
Returns None when the server has cleanly closed the connection.
Returns Some(Err(...)) on transport failure; do not call again after
a transport error.
Sourcefn send_stream_enable(
&mut self,
enable: &ChatStreamEnable,
) -> impl Future<Output = Result<(), ClientError>> + Send
fn send_stream_enable( &mut self, enable: &ChatStreamEnable, ) -> impl Future<Output = Result<(), ClientError>> + Send
Subscribe to ephemeral events (typing indicators and/or presence updates).
Sends a ChatStreamEnable frame to the server. A subsequent call replaces
the prior subscription entirely; re-send after every reconnect because
subscriptions are session-scoped.
Spec: draft-atwood-jmap-chat-wss-00
Sourcefn send_stream_disable(
&mut self,
) -> impl Future<Output = Result<(), ClientError>> + Send
fn send_stream_disable( &mut self, ) -> impl Future<Output = Result<(), ClientError>> + Send
Stop all ephemeral event delivery.
Sends a ChatStreamDisable frame. The server MUST stop delivery silently
even if no subscription is active.
Spec: draft-atwood-jmap-chat-wss-00
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".