blitz_ws/
lib.rs

1#![deny(
2    missing_docs,
3    missing_copy_implementations,
4    missing_debug_implementations,
5    trivial_casts,
6    trivial_numeric_casts,
7    unstable_features,
8    unused_must_use,
9    unused_mut,
10    unused_imports,
11    unused_import_braces
12)]
13//! Blitz: Lightweight WebSocket + HTTP server components
14#![allow(clippy::result_large_err)]
15
16#[cfg(feature = "handshake")]
17pub use http;
18
19#[cfg(feature = "handshake")]
20pub mod client;
21#[cfg(feature = "handshake")]
22pub mod handshake;
23#[cfg(feature = "handshake")]
24mod server;
25
26#[cfg(all(any(feature = "native-tls", feature = "rustls"), feature = "handshake"))]
27mod tls;
28
29pub mod buffer;
30pub mod error;
31pub mod protocol;
32pub mod stream;
33pub mod util;
34
35/// Constant for maximum message payload length
36pub const MAX_ALLOWED_LEN: usize = 16 * 1024 * 1024;
37/// Constant for maximum control frame payload size
38pub const MAX_CONTROL_FRAME_PAYLOAD: usize = 125;
39/// Constant for maximum continuation frames
40pub const MAX_CONTINUATION_FRAMES: usize = 1024;
41
42const READ_BUFFER_SIZE: usize = 4096;
43type ReadBuffer = buffer::ReadBuffer<READ_BUFFER_SIZE>;
44
45pub use bytes::Bytes;
46
47#[cfg(feature = "handshake")]
48pub use crate::{
49    client::{client, connect, ClientRequestBuilder},
50    handshake::{client::ClientHandshake, server::ServerHandshake, HandshakeError},
51    server::{accept, accept_header, accept_header_with_config, accept_with_config},
52};
53
54#[cfg(all(any(feature = "native-tls", feature = "__rustls-tls"), feature = "handshake"))]
55pub use tls::{client_tls, client_tls_with_config, Connector};