Skip to content

open one websocket connection per connection attempt - #217

Merged
fabracht merged 1 commit into
mainfrom
fix-websocket-redial
Oct 11, 2026
Merged

fabracht merged 1 commit into
mainfrom
fix-websocket-redial

Conversation

@fabracht

Copy link
Copy Markdown
Contributor

For each resolved address, MqttClient ran a full ws:// or wss:// handshake, but each handshake dials the URL's host on its own and never uses the address it was given. A failed connect to localhost, which resolves to ::1 and 127.0.0.1, reached the server twice.

WebSocket transports now get one attempt per connect, the same way AWS IoT endpoints already do. TCP, TLS and QUIC still try every resolved address.

tests/client_websocket_dial.rs counts dials against a server that accepts and drops the connection. On main both tests (ws and wss) fail with 2 dials. With this change they pass with 1. The test only discriminates where localhost resolves to more than one address.

@fabracht
fabracht merged commit 2fbb488 into main Oct 11, 2026
16 checks passed
@fabracht
fabracht deleted the fix-websocket-redial branch October 11, 2026 03:28
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.

1 participant