Skip to main content

WebSocketConfig

Struct WebSocketConfig 

Source
pub struct WebSocketConfig {
    pub listen_address: SocketAddr,
    pub path: String,
    pub allowed_origins: Vec<String>,
    pub ping_interval_ms: Option<u64>,
}
Expand description

WebSocket transport acceptor configuration ([websocket], LP-WS-TRANSPORT R1).

The sibling WebSocket route is an explicit opt-in: the section itself must be present for any HTTP/WebSocket listener to start, and inside it the listen address and the single exact upgrade path are required with no defaults.

The deployment TLS contract (tear ruling Q1) is raw ws:// behind a named TLS-terminating proxy that owns public wss:// and certificates; liminal grows no TLS stack. Origin validation nonetheless belongs to this acceptor: Self::allowed_origins is the explicit allow-list checked on every Origin-bearing upgrade, and there is NO default list — absent or empty configuration fails closed for browser-origin upgrades while a native client that sends no Origin header may still upgrade (F6).

OPERATOR NOTE — the same deployment contract covers the pre-upgrade window (domain-owner ruling, 2026-07-18): the fronting proxy must ALSO enforce pre-upgrade read timeouts, handshake concurrency limits, and connection rate limits. Between TCP accept and a completed WebSocket upgrade this listener does not count the socket against [limits] max_connections and applies no read deadline of its own (only the fixed request-head size bound), so a deployment that exposes this port without the named proxy is out of contract on untrusted networks. A named handshake read-deadline config plus an in-flight handshake cap derived from the configured max_connections value is the ledgered post-demo hardening.

Fields§

§listen_address: SocketAddr

Socket address the WebSocket acceptor binds. Required; distinct from the main wire listener, the health listener, and any cluster listener.

§path: String

The single exact HTTP request path that accepts WebSocket upgrades. Required; must start with /. Every other path — and every ordinary HTTP request — receives a small fixed non-success response and closes.

§allowed_origins: Vec<String>

Explicit browser-origin allow-list checked on every Origin-bearing upgrade (F6). Entries are compared byte-exact against the request’s serialized Origin header value (RFC 6454 ASCII serialization, e.g. https://app.example.com). Absent or empty means NO browser origin is accepted (fail closed); native clients sending no Origin header are unaffected.

§ping_interval_ms: Option<u64>

Q-A transport-liveness keepalive: the server-side WebSocket Ping interval in milliseconds. This is a precise LAW-1 carve-out — liveness pings never mint application events, never re-arm application state, and never serve as a source of truth; failure detection remains the socket’s typed terminal events. The bound is one ping per interval per connection, so the idle cost is interval x connection-count. Absent means pings are DISABLED, accepting proxy-idle-disconnect churn as the documented consequence. A configured zero is a validation error.

Trait Implementations§

Source§

impl Clone for WebSocketConfig

Source§

fn clone(&self) -> WebSocketConfig

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 WebSocketConfig

Source§

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

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

impl<'de> Deserialize<'de> for WebSocketConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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