pub struct WebSocketServer { /* private fields */ }Expand description
WebSocket 服务端
专注于 WebSocket 协议层面的连接处理
Implementations§
Source§impl WebSocketServer
impl WebSocketServer
Sourcepub fn new(config: ServerConfig) -> Self
pub fn new(config: ServerConfig) -> Self
创建新的 WebSocket 服务端
Sourcepub fn with_connection_manager(
config: ServerConfig,
connection_manager: Option<Arc<ConnectionManager>>,
) -> Self
pub fn with_connection_manager( config: ServerConfig, connection_manager: Option<Arc<ConnectionManager>>, ) -> Self
使用指定的连接管理器创建 WebSocket 服务端
使用指定的 ServerCore 创建 WebSocket 服务端(用于共享 ServerCore)
Trait Implementations§
Source§impl Server for WebSocketServer
impl Server for WebSocketServer
Source§fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
启动服务器 Read more
Source§fn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
停止服务器 Read more
Source§fn is_running(&self) -> bool
fn is_running(&self) -> bool
检查服务器运行状态 Read more
Auto Trait Implementations§
impl !RefUnwindSafe for WebSocketServer
impl !UnwindSafe for WebSocketServer
impl Freeze for WebSocketServer
impl Send for WebSocketServer
impl Sync for WebSocketServer
impl Unpin for WebSocketServer
impl UnsafeUnpin for WebSocketServer
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