Files
alkhttp/src/websocket/mod.rs
T
glm-5.3-flash da65e5b6db feat(websocket): write-progress timeout on the WS write pump (WS-18)
- DEFAULT_WS_WRITE_TIMEOUT (60 s, WS-01 knob family): one outbound WS
  send that stays unsent past the window (peer stopped reading)
  evicts the connection — the send path was slot-bounded but
  time-unbounded
- bound is per send call: a slow-but-draining peer resets it with
  every message emitted; only a fully stalled sink trips it
- on timeout the pump signals the stream error (InvalidData naming
  the write stall) and ends WITHOUT a close frame — a clogged socket
  cannot receive one and the close send would park on it
- test-support split helper with both knobs explicit backs the
  scaled eviction test (clogged duplex, eviction well inside the
  5 s slack)

Verification: scripts/verify.sh OK (343 passed), clippy -D warnings
clean, fmt clean
2026-08-30 21:36:53 +00:00

33 lines
1.3 KiB
Rust

//! WebSocket subsystem: the browser bidirectional path
//! (ADR-067, `docs/architecture/decisions`).
//!
//! A WS session carries the **channels protocol**: the 8-byte chunk
//! header multiplexes N logical channels over the WS binary message
//! stream; channel 0 is pre-negotiated as `alk/call` and dispatched by
//! the shared `Dispatcher`. The WS↔byte-stream adapter (`byte_adapter`)
//! is the single seam between axum's WS and
//! alkcall's byte-oriented channels machinery — shared with the
//! `from_wss` consumer path ([ADR-070]).
pub mod byte_adapter;
pub mod upgrade;
pub use byte_adapter::{
split_ws_to_bytes, split_ws_to_bytes_idle, WsByteStream, WsPumps, DEFAULT_WS_IDLE_TIMEOUT,
DEFAULT_WS_WRITE_TIMEOUT, INBOUND_WS_FRAME_CAP, INBOUND_WS_MESSAGE_CAP, MAX_CHUNK_LEN,
PENDING_BUFFER_CAP, WS_GOING_AWAY, WS_MESSAGE_CAP, WS_PROTOCOL_ERROR,
};
#[cfg(any(test, feature = "wss"))]
pub use byte_adapter::split_tungstenite_to_bytes;
#[cfg(any(test, feature = "wss"))]
#[allow(unused_imports)]
pub(crate) use upgrade::adapter_install_channel_zero;
pub use upgrade::{
run_channels_session, ws_bearer_auth, ws_upgrade_handler, ChannelsPolicy, SessionState,
WsSessions, DEFAULT_WS_MAX_SESSIONS,
};
#[cfg(any(test, feature = "test-support"))]
pub use upgrade::test_support::{frame_channel0_chunk, ChunkAssembler, FrameAssembler, WsClient};