Skip to content

fix(#169): preserve WS Close reason and reply to the handshake#319

Open
LeJamon wants to merge 1 commit into
XRPLF:mainfrom
LeJamon:fix/issue-169
Open

fix(#169): preserve WS Close reason and reply to the handshake#319
LeJamon wants to merge 1 commit into
XRPLF:mainfrom
LeJamon:fix/issue-169

Conversation

@LeJamon

@LeJamon LeJamon commented May 30, 2026

Copy link
Copy Markdown

Closes #169.

On receiving a WebSocket Close frame, both the Stream adapter and request_impl discarded the frame and returned a bare Disconnected error, and request_impl sent no Close reply.

This captures the peer's close code and reason into a new ConnectionClosed(reason) error, and replies with a Close frame in request_impl to complete the RFC 6455 closing handshake. (tokio-tungstenite already echoes the Close internally for the Stream path.)

Testing

  • cargo test --lib — added close_reason_preserves_peer_detail and close_reason_handles_missing_frame
  • cargo fmt --check; no_std feature set green

On receiving a Close frame both the Stream adapter and request_impl
discarded the frame and reported a bare Disconnected error. Capture the
peer's close code and reason into a new ConnectionClosed error, and reply
with a Close frame in request_impl to complete the RFC 6455 handshake.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebSocket Close frame reason discarded; no Close reply

1 participant