pub struct Server { /* private fields */ }Expand description
WebSocket server
Implementations§
Source§impl Server
impl Server
Sourcepub fn new(config: ServerConfig, handler: BoxedHandler) -> Self
pub fn new(config: ServerConfig, handler: BoxedHandler) -> Self
Create a new server with the given config and handler
Sourcepub fn builder() -> ServerBuilder
pub fn builder() -> ServerBuilder
Create a server builder
Sourcepub async fn serve_with_graceful_shutdown<F>(
self,
shutdown_signal: F,
) -> Result<()>
pub async fn serve_with_graceful_shutdown<F>( self, shutdown_signal: F, ) -> Result<()>
Start serving with graceful shutdown
Sourcepub async fn broadcast_binary_to_all(&self, data: &[u8]) -> Result<()>
pub async fn broadcast_binary_to_all(&self, data: &[u8]) -> Result<()>
Broadcast binary message to all connections
Sourcepub async fn broadcast_text_to_all(&self, text: &str) -> Result<()>
pub async fn broadcast_text_to_all(&self, text: &str) -> Result<()>
Broadcast text message to all connections
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Server
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin for Server
impl !UnwindSafe for Server
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