pub struct WsServer { /* private fields */ }Expand description
WebSocket 服务端
Implementations§
Source§impl WsServer
impl WsServer
Sourcepub fn new(
listen_addr: String,
config: ServerConfig,
connections: Arc<DashMap<u64, ClientConn>>,
router: Arc<RequestRouter>,
subscriptions: Option<Arc<SubscriptionManager>>,
) -> Self
pub fn new( listen_addr: String, config: ServerConfig, connections: Arc<DashMap<u64, ClientConn>>, router: Arc<RequestRouter>, subscriptions: Option<Arc<SubscriptionManager>>, ) -> Self
创建 WsServer,共享 TCP 的连接池、路由器、订阅管理器(无鉴权,向后兼容)
Sourcepub fn with_auth(
listen_addr: String,
config: ServerConfig,
connections: Arc<DashMap<u64, ClientConn>>,
router: Arc<RequestRouter>,
subscriptions: Option<Arc<SubscriptionManager>>,
key_store: Option<Arc<KeyStore>>,
counters: Option<Arc<RuntimeCounters>>,
) -> Self
pub fn with_auth( listen_addr: String, config: ServerConfig, connections: Arc<DashMap<u64, ClientConn>>, router: Arc<RequestRouter>, subscriptions: Option<Arc<SubscriptionManager>>, key_store: Option<Arc<KeyStore>>, counters: Option<Arc<RuntimeCounters>>, ) -> Self
v1.0 入口:同时接入 KeyStore + 共享 RuntimeCounters 做握手鉴权和 per-message
scope / 限额检查。key_store = None 或未配置时保持 legacy(全放行)。
Auto Trait Implementations§
impl Freeze for WsServer
impl !RefUnwindSafe for WsServer
impl Send for WsServer
impl Sync for WsServer
impl Unpin for WsServer
impl !UnwindSafe for WsServer
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