#[non_exhaustive]pub struct Config {Show 22 fields
pub url: String,
pub token: Option<String>,
pub token_provider: Option<TokenProvider>,
pub cookie_name: String,
pub topics: Vec<String>,
pub format: Format,
pub compression: bool,
pub max_message_size: usize,
pub connect_timeout: Duration,
pub ready_timeout: Duration,
pub heartbeat: Duration,
pub idle_timeout: Duration,
pub recovery_timeout: Duration,
pub reconnect: Reconnect,
pub headers: Vec<(String, String)>,
pub send_queue: usize,
pub tls: Option<Arc<dyn Any + Send + Sync>>,
pub encryption: Option<Encryption>,
pub delivery: Option<Delivery>,
pub offline: Option<Offline>,
pub signing_key: Option<Vec<u8>>,
pub server_signing_keys: Vec<String>,
/* private fields */
}Expand description
What a client connects to and how it behaves. The defaults are those of
the Python and TypeScript clients. Its Debug print leaves the token,
the headers’ values and the signing key out.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.url: Stringws://host:port/wse or wss://....
token: Option<String>The JWT, sent in the access_token cookie and as
Authorization: Bearer. Not in the browser: it sends the page’s
cookies itself, and no header.
token_provider: Option<TokenProvider>Asked for the token before each connection attempt (within
connect_timeout); takes the place of token. A refused token is
then fetched again instead of ending the client, three times at most
between two connections the server took.
The cookie the token goes in: the server’s jwt_cookie_name.
topics: Vec<String>Topics to subscribe to once connected, and again after every reconnect from where the client left off.
format: FormatHow the server sends this client its messages.
compression: boolLet the server compress large messages (zlib, above 1 KiB).
max_message_size: usizeThe largest message taken, also after inflating (16 MiB).
connect_timeout: DurationFor the socket, TLS and the upgrade (10 s).
ready_timeout: DurationFor the server to confirm the connection after the upgrade (10 s).
heartbeat: DurationBetween the client’s heartbeats (15 s).
idle_timeout: DurationSilence from the server after which the connection is taken for dead and made again (40 s; the server pings every 25 s).
recovery_timeout: DurationHow long a topic waits for the server to replay messages it missed before reporting the gap (3 s); zero reports it at once.
reconnect: Reconnect§headers: Vec<(String, String)>More headers for the upgrade request (not in the browser, which sends none).
send_queue: usizeMessages waiting to be sent at most; past it try_send fails and
send waits (1024). What a lost connection did not write goes out
on the next one, once the server takes it. Sends that wait for their
topics (Client::send_requiring)
are held besides, as many at most: while that many wait, so does the
queue.
tls: Option<Arc<dyn Any + Send + Sync>>The TLS configuration for wss://: an Arc of a
rustls::ClientConfig of rustls 0.23, which this crate builds on,
held as Any so that rustls’s own versions are not this crate’s.
By default the Mozilla root certificates on aws-lc-rs. In the browser
TLS is the browser’s.
config.tls = Some(std::sync::Arc::new(my_rustls_client_config));encryption: Option<Encryption>End-to-end encryption; none by default.
delivery: Option<Delivery>The recover-or-resync delivery: a topic that is not continuous holds its messages until the application brought its state up to date, and recovery starts from what it committed. None: best effort, where the topics’ states and the checkpoint are kept all the same.
offline: Option<Offline>The outbox: every message sent, except a live or signed one, waits
in it until the server answers for it, and goes again after a
reconnect; a server that answers (3.2) takes each once. In memory by
default; Offline::in_file keeps it past
the application’s end. None: no outbox, and a send with no
connection fails with Error::NotConnected.
signing_key: Option<Vec<u8>>This client’s ECDSA P-256 private key (PKCS#8, PEM or DER) for
Client::send_signed. The server
learns its public key from the token’s cnf claim or from its
application.
server_signing_keys: Vec<String>The server’s signing public keys (base64 of the uncompressed point,
from the server’s signing_public_key) that the messages it signs
are checked against; one failing the check is dropped. Without them
signed messages are delivered unchecked.