Struct ratchet_rs::WebSocketUpgrader
source · pub struct WebSocketUpgrader<S, E> { /* private fields */ }
Expand description
Represents a client connection that has been accepted and the upgrade request validated. This may be used to validate the request by a user and opt to either continue the upgrade or reject the connection - such as if the target path does not exist.
Implementations§
source§impl<S, E> WebSocketUpgrader<S, E>where
S: WebSocketStream,
E: Extension,
impl<S, E> WebSocketUpgrader<S, E>where
S: WebSocketStream,
E: Extension,
sourcepub fn subprotocol(&self) -> Option<&String>
pub fn subprotocol(&self) -> Option<&String>
The subprotocol that the client has requested.
sourcepub async fn upgrade(self) -> Result<UpgradedServer<S, E>, Error>
pub async fn upgrade(self) -> Result<UpgradedServer<S, E>, Error>
Attempt to upgrade this to a fully negotiated WebSocket connection.
§Errors
Errors if there is an IO error.
sourcepub async fn upgrade_with(
self,
headers: HeaderMap,
) -> Result<UpgradedServer<S, E>, Error>
pub async fn upgrade_with( self, headers: HeaderMap, ) -> Result<UpgradedServer<S, E>, Error>
Insert headers
into the response and attempt to upgrade this to a fully negotiated
WebSocket connection.
§Errors
Errors if there is an IO error.
Trait Implementations§
Auto Trait Implementations§
impl<S, E> !Freeze for WebSocketUpgrader<S, E>
impl<S, E> !RefUnwindSafe for WebSocketUpgrader<S, E>
impl<S, E> Send for WebSocketUpgrader<S, E>
impl<S, E> Sync for WebSocketUpgrader<S, E>
impl<S, E> Unpin for WebSocketUpgrader<S, E>
impl<S, E> !UnwindSafe for WebSocketUpgrader<S, E>
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> 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