pub struct WscallServer { /* private fields */ }Expand description
Main server type used to register routes, filters, and event handlers.
Implementations§
Source§impl WscallServer
impl WscallServer
pub fn new() -> Self
Sourcepub fn with_ecdh(self) -> Self
pub fn with_ecdh(self) -> Self
Enables ECDH dynamic key agreement.
Instead of a pre-shared symmetric key, each connection performs an
X25519 handshake right after the WebSocket upgrade. The negotiated
32-byte session key is used with ChaCha20-Poly1305 for all subsequent
frames. This is mutually exclusive with with_chacha20_key /
with_aes256_key.
pub fn with_chacha20_key(self, key: [u8; 32]) -> Self
pub fn with_aes256_key(self, key: [u8; 32]) -> Self
Sourcepub fn with_max_connections(self, max: usize) -> Self
pub fn with_max_connections(self, max: usize) -> Self
Caps the number of concurrently accepted connections.
When the cap is reached, new accept calls block until an existing
connection drops, providing natural backpressure against connection
flooding instead of spawning unbounded tasks.
Sourcepub fn with_max_in_flight(self, max: usize) -> Self
pub fn with_max_in_flight(self, max: usize) -> Self
Caps the number of concurrently in-flight request/event handlers per single connection, bounding per-connection CPU and memory usage.
Sourcepub fn with_max_frame_bytes(self, max: usize) -> Self
pub fn with_max_frame_bytes(self, max: usize) -> Self
Sets the maximum total frame size (including the 4-byte length prefix).
Frames exceeding this limit cause the server to send a 413 error response
frame (request_id=0, code="frame_too_large"); the connection stays
open. Default: 100 MiB.