pub struct WebSocket { /* private fields */ }
Available on crate feature
websocket
only.Expand description
Then WebSocket
provides the API for creating and managing a WebSocket
connection,
as well as for sending and receiving data on the connection.
Implementations§
source§impl WebSocket
impl WebSocket
sourcepub fn protocols<I>(self, protocols: I) -> Self
pub fn protocols<I>(self, protocols: I) -> Self
The specifies one or more protocols that you wish to use.
In order of preference. The first one that is supported by the server will be selected and responsed.
sourcepub fn on_upgrade_with_config<F, Fut>(
self,
callback: F,
config: Option<WebSocketConfig>
) -> Response
pub fn on_upgrade_with_config<F, Fut>( self, callback: F, config: Option<WebSocketConfig> ) -> Response
Finish the upgrade, passing a function and a WebSocketConfig
to handle the WebSocket
.
§Panics
When missing OnUpgrade
sourcepub fn on_upgrade<F, Fut>(self, callback: F) -> Response
pub fn on_upgrade<F, Fut>(self, callback: F) -> Response
Finish the upgrade, passing a function to handle the WebSocket
.
Trait Implementations§
source§impl FromRequest for WebSocket
impl FromRequest for WebSocket
source§impl IntoResponse for WebSocket
impl IntoResponse for WebSocket
source§fn into_response(self) -> Response
fn into_response(self) -> Response
Convert self to HTTP
Response
.source§fn into_error(self) -> Error
fn into_error(self) -> Error
Convert self to the
Error
.Auto Trait Implementations§
impl !Freeze for WebSocket
impl RefUnwindSafe for WebSocket
impl Send for WebSocket
impl Sync for WebSocket
impl Unpin for WebSocket
impl UnwindSafe for WebSocket
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