Skip to main content

Config

Struct Config 

Source
#[non_exhaustive]
pub struct Config {
Show 18 fields pub max_connections: usize, pub allowed_origins: Option<Vec<String>>, pub client_subscriptions: bool, pub e2e_identity_key: Option<Vec<u8>>, pub e2e_legacy: bool, pub signing_key: Option<Vec<u8>>, pub signature_window: u64, pub bind_sessions: bool, pub max_message_size: usize, pub ping_interval: u64, pub idle_timeout: u64, pub max_outbound_queue_bytes: usize, pub max_subscriptions_per_connection: usize, pub rate_limit_capacity: f64, pub rate_limit_refill: f64, pub jwt: Option<JwtSettings>, pub recovery: Option<RecoverySettings>, pub presence: Option<PresenceSettings>, /* private fields */
}
Expand description

What a server is configured with. Start from Config::default() and set the fields that differ: the defaults are those of the Python server. Its Debug print shows whether a key is set, never the key.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§max_connections: usize

Registered connections at most; more are refused (1013).

§allowed_origins: Option<Vec<String>>

Origins a browser may connect from; None: any.

§client_subscriptions: bool

Whether the server answers the clients’ own subscribe and unsubscribe requests.

§e2e_identity_key: Option<Vec<u8>>

The identity key that signs each E2E session handshake: an ECDSA P-256 private key in PKCS#8 (PEM or DER). None: no E2E sessions.

§e2e_legacy: bool

Whether clients may still use the first E2E design.

§signing_key: Option<Vec<u8>>

The server’s key for signed messages: an ECDSA P-256 private key in PKCS#8 (PEM or DER).

§signature_window: u64

How far, in seconds, a signed message’s time may be from the server’s.

§bind_sessions: bool

A token that names the client’s key (cnf) binds the connection to it (true, the default): the client must open an end-to-end session and prove the key inside it before it is admitted, so a token copied on the way opens nothing. False: the key only checks the client’s signed messages, and the token is a bearer token like any other.

§max_message_size: usize

A client’s message is at most this many bytes.

§ping_interval: u64

Seconds between the server’s pings: at least 1, below idle_timeout.

§idle_timeout: u64

A connection silent for this many seconds is closed: at most a week.

§max_outbound_queue_bytes: usize

Bytes waiting to be written to one connection at most; past them it misses messages, and a connection over them for two pings is closed (1013). 0: no limit.

§max_subscriptions_per_connection: usize

Topics one connection may subscribe to at most; 0: no limit.

§rate_limit_capacity: f64

A connection’s messages: a token bucket of this many.

§rate_limit_refill: f64

… refilled at this many per second.

§jwt: Option<JwtSettings>

Tokens the server validates itself; None: the application accepts each connection (Publisher::accept).

§recovery: Option<RecoverySettings>

Message history for clients that come back; None: no recovery.

§presence: Option<PresenceSettings>

Who is on a topic; None: no presence.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for Config

§

impl Freeze for Config

§

impl Move for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnsafeUnpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more