[][src]Struct embedded_websocket::WebSocketOptions

pub struct WebSocketOptions<'a> {
    pub path: &'a str,
    pub host: &'a str,
    pub origin: &'a str,
    pub sub_protocols: Option<&'a [&'a str]>,
    pub additional_headers: Option<&'a [&'a str]>,
}

Websocket options used by a websocket client to initiate an opening handshake with a websocket server

Fields

path: &'a str

The request uri (e.g. /chat?id=123) of the GET method used to identify the endpoint of the websocket connection. This allows multiple domains to be served by a single server. This could also be used to send identifiable information about the client

host: &'a str

The hostname (e.g. server.example.com) is used so that both the client and the server can verify that they agree on which host is in use

origin: &'a str

The origin (e.g. http://example.com) is used to protect against unauthorized cross-origin use of a WebSocket server by scripts using the WebSocket API in a web browser. This field is usually only set by browser clients but servers may require it so it has been exposed here.

sub_protocols: Option<&'a [&'a str]>

A list of requested sub protocols in order of preference. The server should return the first sub protocol it supports or none at all. A sub protocol can be anything agreed between the server and client

additional_headers: Option<&'a [&'a str]>

Any additional headers the server may require that are not part of the websocket spec. These should be fully formed http headers without the \r\n (e.g. MyHeader: foo)

Auto Trait Implementations

impl<'a> Send for WebSocketOptions<'a>

impl<'a> Sync for WebSocketOptions<'a>

Blanket Implementations

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> Into<U> for T where
    U: From<T>, 
[src]

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

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self