pub struct ObserverServer { /* private fields */ }Expand description
观察者模式服务器实例
Implementations§
Source§impl ObserverServer
impl ObserverServer
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
检查服务器是否运行
Sourcepub fn connection_count(&self) -> usize
pub fn connection_count(&self) -> usize
获取连接数量
Sourcepub fn user_count(&self) -> usize
pub fn user_count(&self) -> usize
获取用户数量
Sourcepub async fn broadcast_except(
&self,
frame: &Frame,
exclude_connection_id: &str,
) -> Result<()>
pub async fn broadcast_except( &self, frame: &Frame, exclude_connection_id: &str, ) -> Result<()>
广播消息到所有连接,排除指定连接
Sourcepub async fn disconnect(&self, connection_id: &str) -> Result<()>
pub async fn disconnect(&self, connection_id: &str) -> Result<()>
断开指定连接
Sourcepub fn protocols(&self) -> Vec<TransportProtocol>
pub fn protocols(&self) -> Vec<TransportProtocol>
获取协议列表
Sourcepub fn get_server_handle_components(
&self,
) -> Option<Arc<dyn ConnectionManagerTrait>>
pub fn get_server_handle_components( &self, ) -> Option<Arc<dyn ConnectionManagerTrait>>
Sourcepub fn get_server_handle(&self) -> Option<Arc<dyn ServerHandle>>
pub fn get_server_handle(&self) -> Option<Arc<dyn ServerHandle>>
获取 ServerHandle(用于消息发送和连接管理)
Auto Trait Implementations§
impl !RefUnwindSafe for ObserverServer
impl !UnwindSafe for ObserverServer
impl Freeze for ObserverServer
impl Send for ObserverServer
impl Sync for ObserverServer
impl Unpin for ObserverServer
impl UnsafeUnpin for ObserverServer
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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