[][src]Struct ws::Settings

pub struct Settings {
    pub max_connections: usize,
    pub queue_size: usize,
    pub panic_on_new_connection: bool,
    pub panic_on_shutdown: bool,
    pub fragments_capacity: usize,
    pub fragments_grow: bool,
    pub fragment_size: usize,
    pub max_fragment_size: usize,
    pub in_buffer_capacity: usize,
    pub in_buffer_grow: bool,
    pub out_buffer_capacity: usize,
    pub out_buffer_grow: bool,
    pub panic_on_internal: bool,
    pub panic_on_capacity: bool,
    pub panic_on_protocol: bool,
    pub panic_on_encoding: bool,
    pub panic_on_queue: bool,
    pub panic_on_io: bool,
    pub panic_on_timeout: bool,
    pub shutdown_on_interrupt: bool,
    pub masking_strict: bool,
    pub key_strict: bool,
    pub method_strict: bool,
    pub encrypt_server: bool,
    pub tcp_nodelay: bool,
}

WebSocket settings

Fields

max_connections: usize

The maximum number of connections that this WebSocket will support. The default setting is low and should be increased when expecting more connections because this is a hard limit and no new connections beyond this limit can be made until an old connection is dropped. Default: 100

queue_size: usize

The number of events anticipated per connection. The event loop queue size will be queue_size * max_connections. In order to avoid an overflow error, queue_size * max_connections must be less than or equal to usize::max_value(). The queue is shared between connections, which means that a connection may schedule more events than queue_size provided that another connection is using less than queue_size. However, if the queue is maxed out a Queue error will occur. Default: 5

panic_on_new_connection: bool

Whether to panic when unable to establish a new TCP connection. Default: false

panic_on_shutdown: bool

Whether to panic when a shutdown of the WebSocket is requested. Default: false

fragments_capacity: usize

The maximum number of fragments the connection can handle without reallocating. Default: 10

fragments_grow: bool

Whether to reallocate when fragments_capacity is reached. If this is false, a Capacity error will be triggered instead. Default: true

fragment_size: usize

The maximum length of outgoing frames. Messages longer than this will be fragmented. Default: 65,535

max_fragment_size: usize

The maximum length of acceptable incoming frames. Messages longer than this will be rejected. Default: unlimited

in_buffer_capacity: usize

The size of the incoming buffer. A larger buffer uses more memory but will allow for fewer reallocations. Default: 2048

in_buffer_grow: bool

Whether to reallocate the incoming buffer when in_buffer_capacity is reached. If this is false, a Capacity error will be triggered instead. Default: true

out_buffer_capacity: usize

The size of the outgoing buffer. A larger buffer uses more memory but will allow for fewer reallocations. Default: 2048

out_buffer_grow: bool

Whether to reallocate the incoming buffer when out_buffer_capacity is reached. If this is false, a Capacity error will be triggered instead. Default: true

panic_on_internal: bool

Whether to panic when an Internal error is encountered. Internal errors should generally not occur, so this setting defaults to true as a debug measure, whereas production applications should consider setting it to false. Default: true

panic_on_capacity: bool

Whether to panic when a Capacity error is encountered. Default: false

panic_on_protocol: bool

Whether to panic when a Protocol error is encountered. Default: false

panic_on_encoding: bool

Whether to panic when an Encoding error is encountered. Default: false

panic_on_queue: bool

Whether to panic when a Queue error is encountered. Default: false

panic_on_io: bool

Whether to panic when an Io error is encountered. Default: false

panic_on_timeout: bool

Whether to panic when a Timer error is encountered. Default: false

shutdown_on_interrupt: bool

Whether to shutdown the eventloop when an interrupt is received. Default: true

masking_strict: bool

The WebSocket protocol requires frames sent from client endpoints to be masked as a security and sanity precaution. Enforcing this requirement, which may be removed at some point may cause incompatibilities. If you need the extra security, set this to true. Default: false

key_strict: bool

The WebSocket protocol requires clients to verify the key returned by a server to ensure that the server and all intermediaries can perform the protocol. Verifying the key will consume processing time and other resources with the benefit that we can fail the connection early. The default in WS-RS is to accept any key from the server and instead fail late if a protocol error occurs. Change this setting to enable key verification. Default: false

method_strict: bool

The WebSocket protocol requires clients to perform an opening handshake using the HTTP GET method for the request. However, since only WebSockets are supported on the connection, verifying the method of handshake requests is not always necessary. To enforce the requirement that handshakes begin with a GET method, set this to true. Default: false

encrypt_server: bool

Indicate whether server connections should use ssl encryption when accepting connections. Setting this to true means that clients should use the wss scheme to connect to this server. Note that using this flag will in general necessitate overriding the Handler::upgrade_ssl_server method in order to provide the details of the ssl context. It may be simpler for most users to use a reverse proxy such as nginx to provide server side encryption.

Default: false

tcp_nodelay: bool

Disables Nagle's algorithm. Usually tcp socket tries to accumulate packets to send them all together (every 200ms). When enabled socket will try to send packet as fast as possible.

Default: false

Trait Implementations

impl Clone for Settings[src]

impl Copy for Settings[src]

impl Default for Settings[src]

impl Debug for Settings[src]

Auto Trait Implementations

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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<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<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self