Struct ws::Settings [] [src]

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 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 Debug for Settings
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for Settings
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Settings
[src]

impl Default for Settings
[src]

[src]

Returns the "default value" for a type. Read more