Skip to main content

ChatWsExt

Trait ChatWsExt 

Source
pub trait ChatWsExt {
    // 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;

Required Methods§

Source

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.

Source

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

Source

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", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ChatWsExt for WsSession

Implementors§