pub struct WebSocketUpgrade { /* private fields */ }Available on crate feature
websockets only.Expand description
An extractor to establish a WebSocket connection.
Implementations§
Source§impl WebSocketUpgrade
impl WebSocketUpgrade
Sourcepub fn select_protocol<Func>(
&mut self,
selector: Func,
) -> Result<Option<Cow<'_, str>>, WebSocketUpgradeError>
pub fn select_protocol<Func>( &mut self, selector: Func, ) -> Result<Option<Cow<'_, str>>, WebSocketUpgradeError>
Calls the given function for each listed protocol in the Sec-WebSocket-Protocol
header and selects the one the given function returned true for.
Sourcepub fn set_message_size_limit(&mut self, size_limit: usize) -> &mut Self
pub fn set_message_size_limit(&mut self, size_limit: usize) -> &mut Self
Sets the maximum size limit for the message.
Sourcepub fn turn_off_auto_unmasking(&mut self) -> &mut Self
pub fn turn_off_auto_unmasking(&mut self) -> &mut Self
Turns off the auto unmasking the messages.
Sourcepub fn turn_off_auto_sending_pong(&mut self) -> &mut Self
pub fn turn_off_auto_sending_pong(&mut self) -> &mut Self
Turns off automatically sending the pong messages.
Sourcepub fn turn_on_auto_closing(&mut self) -> &mut Self
pub fn turn_on_auto_closing(&mut self) -> &mut Self
Turns on auto-responding to close messages.
Trait Implementations§
Source§impl<B> FromRequest<B> for WebSocketUpgrade
impl<B> FromRequest<B> for WebSocketUpgrade
type Error = WebSocketUpgradeError
fn from_request( head_parts: &mut RequestHeadParts, _: B, ) -> impl Future<Output = Result<Self, Self::Error>>
Auto Trait Implementations§
impl !Freeze for WebSocketUpgrade
impl !RefUnwindSafe for WebSocketUpgrade
impl Send for WebSocketUpgrade
impl Sync for WebSocketUpgrade
impl Unpin for WebSocketUpgrade
impl !UnwindSafe for WebSocketUpgrade
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