pub struct ChatRoomConnection { /* private fields */ }Expand description
聊天室长连接:接收消息、注册监听、缓存在线/话题、断开重连。
Implementations§
Source§impl ChatRoomConnection
impl ChatRoomConnection
Sourcepub async fn on_discuss<F>(&self, listener: F)
pub async fn on_discuss<F>(&self, listener: F)
监听话题变更,并刷新缓存。
Sourcepub async fn on_barrager<F>(&self, listener: F)
pub async fn on_barrager<F>(&self, listener: F)
监听弹幕。
Sourcepub async fn on_redpacket<F>(&self, listener: F)
pub async fn on_redpacket<F>(&self, listener: F)
监听红包消息。
Sourcepub async fn on_redpacket_status<F>(&self, listener: F)
pub async fn on_redpacket_status<F>(&self, listener: F)
监听红包状态。
Sourcepub async fn on_weather<F>(&self, listener: F)
pub async fn on_weather<F>(&self, listener: F)
监听天气消息。
Sourcepub async fn on_chat_reaction<F>(&self, listener: F)
pub async fn on_chat_reaction<F>(&self, listener: F)
监听表态消息。
Sourcepub async fn off(&self, kind: ChatRoomEventKind)
pub async fn off(&self, kind: ChatRoomEventKind)
移除某类监听。
Sourcepub async fn online_count(&self) -> usize
pub async fn online_count(&self) -> usize
当前缓存在线人数。
Sourcepub fn set_retry_policy(&mut self, policy: RetryPolicy)
pub fn set_retry_policy(&mut self, policy: RetryPolicy)
设置重连策略。
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
断开连接。
Auto Trait Implementations§
impl !RefUnwindSafe for ChatRoomConnection
impl !UnwindSafe for ChatRoomConnection
impl Forget for ChatRoomConnection
impl Freeze for ChatRoomConnection
impl Move for ChatRoomConnection
impl Send for ChatRoomConnection
impl Sync for ChatRoomConnection
impl Unpin for ChatRoomConnection
impl UnsafeUnpin for ChatRoomConnection
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