pub struct Settings {Show 22 fields
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 masking_strict: bool,
pub key_strict: bool,
pub method_strict: bool,
pub encrypt_server: bool,
}Expand description
WebSocket settings
Fields§
§max_connections: usizeThe 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: usizeThe 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: boolWhether to panic when unable to establish a new TCP connection. Default: false
panic_on_shutdown: boolWhether to panic when a shutdown of the WebSocket is requested. Default: false
fragments_capacity: usizeThe maximum number of fragments the connection can handle without reallocating. Default: 10
fragments_grow: boolWhether to reallocate when fragments_capacity is reached. If this is false,
a Capacity error will be triggered instead.
Default: true
fragment_size: usizeThe maximum length of outgoing frames. Messages longer than this will be fragmented. Default: 65,535
in_buffer_capacity: usizeThe size of the incoming buffer. A larger buffer uses more memory but will allow for fewer reallocations. Default: 2048
in_buffer_grow: boolWhether 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: usizeThe size of the outgoing buffer. A larger buffer uses more memory but will allow for fewer reallocations. Default: 2048
out_buffer_grow: boolWhether 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: boolWhether 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: boolWhether to panic when a Capacity error is encountered. Default: false
panic_on_protocol: boolWhether to panic when a Protocol error is encountered. Default: false
panic_on_encoding: boolWhether to panic when an Encoding error is encountered. Default: false
panic_on_queue: boolWhether to panic when a Queue error is encountered. Default: false
panic_on_io: boolWhether to panic when an Io error is encountered. Default: false
panic_on_timeout: boolWhether to panic when a Timer error is encountered. Default: false
masking_strict: boolThe 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: boolThe 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 benifit 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: boolThe 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: boolIndicate 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::build_ssl 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