pub struct ChatStreamLimits { /* private fields */ }Available on crate feature
websocket only.Expand description
The outbound rate limits a ChatStreamHandler applies, per
connection.
The default is the draft’s:
- typing: “no more than one
ChatTypingEventper sender per chat per 3 seconds SHOULD be delivered; events above this rate MAY be silently dropped” (draft-atwood-jmap-chat-wss-00 §ChatTypingEvent). Events over the limit are dropped, excepttyping: false, which is always delivered and does not count against the window, so a client never misses a stop (decision 66). - presence: “no more than one
ChatPresenceEventper contact per 30 seconds SHOULD be delivered; events above this rate MAY be silently dropped, but the most recent presence state SHOULD be delivered when the rate window reopens” (§ChatPresenceEvent). The latest event over the limit is held and sent when the window reopens, after the delivery checks run again.
Implementations§
Source§impl ChatStreamLimits
impl ChatStreamLimits
Sourcepub fn typing_window(self, window: Option<Duration>) -> Self
pub fn typing_window(self, window: Option<Duration>) -> Self
The typing window: at most one event per sender per Chat in it;
None for no limit.
Sourcepub fn presence_window(self, window: Option<Duration>) -> Self
pub fn presence_window(self, window: Option<Duration>) -> Self
The presence window: at most one event per contact in it, the
latest one over the limit sent when it reopens; None for no
limit.
Sourcepub fn typing_window_value(&self) -> Option<Duration>
pub fn typing_window_value(&self) -> Option<Duration>
The typing window.
Sourcepub fn presence_window_value(&self) -> Option<Duration>
pub fn presence_window_value(&self) -> Option<Duration>
The presence window.
Trait Implementations§
Source§impl Clone for ChatStreamLimits
impl Clone for ChatStreamLimits
impl Copy for ChatStreamLimits
Source§impl Debug for ChatStreamLimits
impl Debug for ChatStreamLimits
Source§impl Default for ChatStreamLimits
impl Default for ChatStreamLimits
impl Eq for ChatStreamLimits
Source§impl PartialEq for ChatStreamLimits
impl PartialEq for ChatStreamLimits
impl StructuralPartialEq for ChatStreamLimits
Auto Trait Implementations§
impl Forget for ChatStreamLimits
impl Freeze for ChatStreamLimits
impl Move for ChatStreamLimits
impl RefUnwindSafe for ChatStreamLimits
impl Send for ChatStreamLimits
impl Sync for ChatStreamLimits
impl Unpin for ChatStreamLimits
impl UnsafeUnpin for ChatStreamLimits
impl UnwindSafe for ChatStreamLimits
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.