pub struct SimpleServer { /* private fields */ }Expand description
简化的服务器实例
提供简化的接口,自动处理服务器引用
Implementations§
Source§impl SimpleServer
impl SimpleServer
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 fn handle(&self) -> Arc<dyn ServerHandle> ⓘ
pub fn handle(&self) -> Arc<dyn ServerHandle> ⓘ
获取 ServerHandle(用于消息发送和连接管理)
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>
获取协议列表
Auto Trait Implementations§
impl !RefUnwindSafe for SimpleServer
impl !UnwindSafe for SimpleServer
impl Freeze for SimpleServer
impl Send for SimpleServer
impl Sync for SimpleServer
impl Unpin for SimpleServer
impl UnsafeUnpin for SimpleServer
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