Skip to content

Comments

feat(transport-ws): make keepalive interval configurable#3660

Merged
onbjerg merged 2 commits intomainfrom
danipopes/ws-keepalive-config
Feb 9, 2026
Merged

feat(transport-ws): make keepalive interval configurable#3660
onbjerg merged 2 commits intomainfrom
danipopes/ws-keepalive-config

Conversation

@gakonst
Copy link
Member

@gakonst gakonst commented Feb 7, 2026

Summary

Add with_keepalive_interval to WsConnect, replacing the hardcoded 10s KEEPALIVE constant.

Motivation

reth-bench persistence subscriptions disconnect during long MDBX fsyncs (29s+). The server can't respond to pings while stalled by I/O, so alloy's 10s keepalive kills the connection with "WS server missed a pong". Making this configurable lets consumers like reth-bench set a longer interval.

Changes

  • Add keepalive_interval: Duration field to WsConnect (default 10s, backwards-compatible)
  • Add with_keepalive_interval(Duration) builder method
  • Thread the interval through WsBackend and use it in spawn() instead of the hardcoded constant
  • Update WASM backend to match the new WsBackend struct shape

Testing

cargo check -p alloy-transport-ws
cargo clippy -p alloy-transport-ws -- -D warnings
cargo +nightly fmt --all --check

All clean.

@github-project-automation github-project-automation bot moved this to Reviewed in Alloy Feb 7, 2026
@gakonst
Copy link
Member Author

gakonst commented Feb 8, 2026

Wait why are we fsyncing for 29 seconds lol

@DaniPopes
Copy link
Member

on startup

@onbjerg onbjerg merged commit d1dbde5 into main Feb 9, 2026
30 checks passed
@onbjerg onbjerg deleted the danipopes/ws-keepalive-config branch February 9, 2026 11:24
@github-project-automation github-project-automation bot moved this from Reviewed to Done in Alloy Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants