[][src]Struct salvo_extra::ws::WsHandler

pub struct WsHandler { /* fields omitted */ }

Creates a Websocket Handler. Request:

  • Method must be GET
  • Header connection must be upgrade
  • Header upgrade must be websocket
  • Header sec-websocket-version must be 13
  • Header sec-websocket-key must be set.

Response:

  • Status of 101 Switching Protocols
  • Header connection: upgrade
  • Header upgrade: websocket
  • Header sec-websocket-accept with the hash value of the received key.

Implementations

impl WsHandler[src]

pub fn new() -> Self[src]

pub fn with_config(config: WebSocketConfig) -> Self[src]

pub fn max_send_queue(mut self: Self, max: usize) -> Self[src]

Set the size of the internal message send queue.

pub fn max_message_size(mut self: Self, max: usize) -> Self[src]

Set the maximum message size (defaults to 64 megabytes)

pub fn max_frame_size(mut self: Self, max: usize) -> Self[src]

Set the maximum frame size (defaults to 16 megabytes)

pub fn handle(
    &self,
    req: &mut Request,
    res: &mut Response
) -> Result<impl Future<Output = Option<WebSocket>>, HttpError>
[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]