pub struct WebSocketServer { /* private fields */ }Implementations§
Source§impl WebSocketServer
impl WebSocketServer
pub fn new(yrs_manager: Arc<YrsManager>) -> Self
Sourcepub async fn start(
self: Arc<Self>,
addr: SocketAddr,
sync_service: Arc<SyncService>,
runtime: Arc<Mutex<ForgeRuntime>>,
) -> Result<()>
pub async fn start( self: Arc<Self>, addr: SocketAddr, sync_service: Arc<SyncService>, runtime: Arc<Mutex<ForgeRuntime>>, ) -> Result<()>
启动 WebSocket 服务器
Sourcepub fn client_count(&self) -> usize
pub fn client_count(&self) -> usize
获取在线客户端数量
Sourcepub fn room_count(&self) -> usize
pub fn room_count(&self) -> usize
获取房间数量
Sourcepub fn broadcast_to_room(
&self,
room_id: &str,
message: String,
exclude_client: Option<String>,
) -> Result<()>
pub fn broadcast_to_room( &self, room_id: &str, message: String, exclude_client: Option<String>, ) -> Result<()>
🚀 主动推送消息到房间
Auto Trait Implementations§
impl Freeze for WebSocketServer
impl !RefUnwindSafe for WebSocketServer
impl Send for WebSocketServer
impl Sync for WebSocketServer
impl Unpin for WebSocketServer
impl !UnwindSafe for WebSocketServer
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more