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
sourceimpl<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<HeaderValue>
) -> Result<UpgradedServer<S, E>, Error>
pub async fn upgrade_with(
self,
headers: HeaderMap<HeaderValue>
) -> 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> !RefUnwindSafe for WebSocketUpgrader<S, E>
impl<S, E> Send for WebSocketUpgrader<S, E> where
E: Send,
S: Send,
impl<S, E> Sync for WebSocketUpgrader<S, E> where
E: Sync,
S: Sync,
impl<S, E> Unpin for WebSocketUpgrader<S, E> where
E: Unpin,
S: Unpin,
impl<S, E> !UnwindSafe for WebSocketUpgrader<S, E>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more