Struct tokio_websockets::server::Builder
source · pub struct Builder { /* private fields */ }
Available on crate feature
server
only.Expand description
Builder for WebSocket server connections.
Implementations§
source§impl Builder
impl Builder
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a Builder
that can be used to create a WebSocketStream
to receive messages at the server end.
sourcepub async fn accept<S: AsyncRead + AsyncWrite + Unpin>(
&self,
stream: S,
) -> Result<WebSocketStream<S>, Error>
pub async fn accept<S: AsyncRead + AsyncWrite + Unpin>( &self, stream: S, ) -> Result<WebSocketStream<S>, Error>
sourcepub fn serve<S: AsyncRead + AsyncWrite + Unpin>(
&self,
stream: S,
) -> WebSocketStream<S>
pub fn serve<S: AsyncRead + AsyncWrite + Unpin>( &self, stream: S, ) -> WebSocketStream<S>
Takes over an already established stream and uses it to send and receive WebSocket messages.
This does not perform a HTTP upgrade handshake.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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