Expand description
§polyoxide-ws
The WebSocket kit the polyoxide socket clients share. Each block here was carried as a copy by every socket crate (five of them); this crate holds the one copy, and each venue keeps only what is its own.
ensure_crypto_providerinstalls the process-default rustls provider atokio-tungsteniteconnect needs.Backoffis the reconnect delay schedule.Timingholds a supervised connection’s ping, staleness, backoff, connect and rotation timings,timing_setters!gives a builder its setters, andnext_waitis the wait until the first deadline.WsErroris the one socket error, read through itsKind.polyoxide_venue::impl_ws_classification!classifies it in the venue crate that wraps it.connectopens a connection within a timeout,connect_overupgrades a TCP connection a venue opened itself,with_timeoutbounds a venue’s own connect, andretrying_can_fixsays whether a reconnect can help after one failed.Connectionis the bare tier: one connection as aStreamof its frames in aMode, with the server’s close captured, and requests correlated with their answers throughCorrelated.Supervisorruns one supervised connection for a venue’sProtocol: pings on the wall clock, staleness, reconnect with backoff and a replay of the membership, rotation, outage markers, and membership changes through aMembershipHandle, yielding aSupervisedstream.
tungstenite is re-exported, so a venue names Message and
CloseFrame through this crate rather than depending on it.
Behind the test-server feature, the doc-hidden test_server module holds
the scripted local server and the helpers the offline suites share. It is
for tests, not consumers.
The crate depends on neither polyoxide-core nor polyoxide-venue, and
builds no HTTP or signing stack, so a credential-free feed built on it
stays light (AD-2). It logs under the polyoxide_ws target and never
installs a subscriber.
Re-exports§
pub use tokio_tungstenite::tungstenite;
Macros§
- timing_
setters - Generates the timing setters a supervised builder offers, each writing the
builder’s
timingfield, aTiming.
Structs§
- Backoff
- The reconnect delay schedule: doubling from an initial delay to a ceiling, and back to the start after a connection that delivered something.
- Connection
- One open connection, as a
Streamof its frames. - Membership
Handle - Changes the membership of a running
Supervised. - Supervised
- A supervised connection: a
Streamof the protocol’s events, and of the errors it skips past or stops on, that survives drops, stalls and rotations by reconnecting and replaying its membership. - Supervisor
- Starts a supervised connection for a
Protocol. - Timing
- The timings a supervised connection runs on.
- WsError
- A WebSocket failure: a transport error, a refused upgrade, a server close, or one of the kit’s own timeouts.
Enums§
- Correlated
- What a frame read while a request awaits its answer is, as the caller’s matcher reads it.
- Decoded
- What one frame decodes to.
- Kind
- What kind of failure a
WsErroris. - Mode
- Which frames a
Connectionyields. - Offline
- What becomes of a membership change made while no connection is up.
- Outage
- Why a connection went down, for
Protocol::disconnected, which owns it, so a protocol’s marker can carry the error. - Queue
- The queue between the task and the consumer.
- Recovery
- What to do after a failure.
Constants§
- DEFAULT_
CONNECT_ TIMEOUT - How long one connection attempt may take unless a venue says otherwise: the TCP connect, the TLS handshake and the WebSocket upgrade together.
- MIN_
BACKOFF - The shortest delay. Zero would never grow, so a dead host would be retried on every timer tick.
Traits§
- Protocol
- A venue’s socket protocol, as the
Supervisordrives it.
Functions§
- connect
- Open a connection, giving up after
timeout. - connect_
over - Upgrade a TCP connection the caller opened itself: the TLS handshake when
requestis awss://URL, then the WebSocket upgrade. - ensure_
crypto_ provider - Make sure rustls has a default
CryptoProviderbefore a connection opens. - next_
wait - The wait until the first of several deadlines falls due.
- retrying_
can_ fix - Whether reconnecting can help after a connect failed this way.
- with_
timeout - Run a caller’s own connect future, giving up after
timeoutwithKind::ConnectTimeout.
Type Aliases§
- Socket
- An open connection, over TLS or plain TCP.