pub struct RoomSendQueue { /* private fields */ }
Expand description
A per-room send queue.
This is cheap to clone.
Implementations§
Source§impl RoomSendQueue
impl RoomSendQueue
Sourcepub async fn send_attachment(
&self,
filename: &str,
content_type: Mime,
data: Vec<u8>,
config: AttachmentConfig,
) -> Result<SendHandle, RoomSendQueueError>
pub async fn send_attachment( &self, filename: &str, content_type: Mime, data: Vec<u8>, config: AttachmentConfig, ) -> Result<SendHandle, RoomSendQueueError>
Queues an attachment to be sent to the room, using the send queue.
This returns quickly (without sending or uploading anything), and will push the event to be sent into a queue, handled in the background.
Callers are expected to consume RoomSendQueueUpdate
via calling
the Self::subscribe()
method to get updates about the sending of
that event.
By default, if sending failed on the first attempt, it will be retried a few times. If sending failed after those retries, the entire client’s sending queue will be disabled, and it will need to be manually re-enabled by the caller (e.g. after network is back, or when something has been done about the faulty requests).
The attachment and its optional thumbnail are stored in the media cache
and can be retrieved at any time, by calling
Media::get_media_content()
with the MediaSource
that can be found
in the local or remote echo, and using a MediaFormat::File
.
Source§impl RoomSendQueue
impl RoomSendQueue
Sourcepub async fn send_raw(
&self,
content: Raw<AnyMessageLikeEventContent>,
event_type: String,
) -> Result<SendHandle, RoomSendQueueError>
pub async fn send_raw( &self, content: Raw<AnyMessageLikeEventContent>, event_type: String, ) -> Result<SendHandle, RoomSendQueueError>
Queues a raw event for sending it to this room.
This immediately returns, and will push the event to be sent into a queue, handled in the background.
Callers are expected to consume RoomSendQueueUpdate
via calling
the Self::subscribe()
method to get updates about the sending of
that event.
By default, if sending failed on the first attempt, it will be retried a few times. If sending failed after those retries, the entire client’s sending queue will be disabled, and it will need to be manually re-enabled by the caller (e.g. after network is back, or when something has been done about the faulty requests).
Sourcepub async fn send(
&self,
content: AnyMessageLikeEventContent,
) -> Result<SendHandle, RoomSendQueueError>
pub async fn send( &self, content: AnyMessageLikeEventContent, ) -> Result<SendHandle, RoomSendQueueError>
Queues an event for sending it to this room.
This immediately returns, and will push the event to be sent into a queue, handled in the background.
Callers are expected to consume RoomSendQueueUpdate
via calling
the Self::subscribe()
method to get updates about the sending of
that event.
By default, if sending failed on the first attempt, it will be retried a few times. If sending failed after those retries, the entire client’s sending queue will be disabled, and it will need to be manually re-enabled by the caller (e.g. after network is back, or when something has been done about the faulty requests).
Sourcepub async fn subscribe(
&self,
) -> Result<(Vec<LocalEcho>, Receiver<RoomSendQueueUpdate>), RoomSendQueueError>
pub async fn subscribe( &self, ) -> Result<(Vec<LocalEcho>, Receiver<RoomSendQueueUpdate>), RoomSendQueueError>
Returns the current local requests as well as a receiver to listen to
the send queue updates, as defined in RoomSendQueueUpdate
.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns whether the room is enabled, at the room level.
Sourcepub fn set_enabled(&self, enabled: bool)
pub fn set_enabled(&self, enabled: bool)
Set the locally enabled flag for this room queue.
Trait Implementations§
Source§impl Clone for RoomSendQueue
impl Clone for RoomSendQueue
Source§fn clone(&self) -> RoomSendQueue
fn clone(&self) -> RoomSendQueue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for RoomSendQueue
impl !RefUnwindSafe for RoomSendQueue
impl Send for RoomSendQueue
impl Sync for RoomSendQueue
impl Unpin for RoomSendQueue
impl !UnwindSafe for RoomSendQueue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more