Trait HttpClientWebSocketExt

pub trait HttpClientWebSocketExt<Body>:
    Sized
    + HttpClientWebSocketExtSealed<Body>
    + Send
    + Sync
    + 'static {
    // Required methods
    fn websocket(
        &self,
        url: impl IntoUrl,
    ) -> WebSocketRequestBuilder<WithService<'_, Self, Body>>;
    fn websocket_h2(
        &self,
        url: impl IntoUrl,
    ) -> WebSocketRequestBuilder<WithService<'_, Self, Body>>;
    fn websocket_with_request<RequestBody>(
        &self,
        req: Request<RequestBody>,
    ) -> WebSocketRequestBuilder<WithService<'_, Self, Body>>
       where RequestBody: Into<Body>;
}
Expand description

Extends an Http Client with high level features WebSocket features.

Required Methods§

fn websocket( &self, url: impl IntoUrl, ) -> WebSocketRequestBuilder<WithService<'_, Self, Body>>

Create a new WebSocketRequestBuilder] to be used to establish a WebSocket connection over http/1.1.

fn websocket_h2( &self, url: impl IntoUrl, ) -> WebSocketRequestBuilder<WithService<'_, Self, Body>>

Create a new WebSocketRequestBuilder to be used to establish a WebSocket connection over h2.

fn websocket_with_request<RequestBody>( &self, req: Request<RequestBody>, ) -> WebSocketRequestBuilder<WithService<'_, Self, Body>>
where RequestBody: Into<Body>,

Create a new WebSocketRequestBuilder starting from the given request.

This is useful in cases where you already have a request that you wish to use, for example in the case of a proxied reuqest.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl<S, Body> HttpClientWebSocketExt<Body> for S
where S: Service<Request<Body>, Response = Response<Body>>, <S as Service<Request<Body>>>::Error: Into<Box<dyn Error + Sync + Send>>,