Files
plezy/lib/utils/web_socket_connect_stub.dart
T
edde746 01750ad92b fix(network): own a WebSocket connection attempt through cancellation and TLS
Cancelling a WebSocket connect (deadline, stop, dispose, a newer attempt)
only dropped or timed out a future: the shared never-closed HttpClient kept
the address race and TLS handshake alive, and once SecureSocket.secure had
detached the raw socket even a real task cancel was a no-op, so after
ClientHello the peer stayed open and the connect future never settled.

The happy-eyeballs task now owns the transport through the TLS handoff:
cancel is idempotent, settles the task at once, destroys an undelivered raw
winner, and destroys whatever a handshake in flight eventually yields. Each
WebSocket upgrade runs on its own HttpClient inside a connection attempt
with completion plus cancellation; the library-event, companion-remote and
Watch Together relay sockets cancel it on stop, disposal, deadline and
supersession. dart:io offers no handle to abort an in-flight handshake, so
a black-holed ClientHello closes when the handshake settles, not at cancel.
2026-09-06 13:28:51 +02:00

7 lines
349 B
Dart

import 'package:web_socket_channel/web_socket_channel.dart';
/// Web fallback: the browser owns the transport, so there is no client to
/// bound or cancel; selected via conditional import next to
/// `web_socket_connect.dart`.
WebSocketChannel connectWebSocketChannel(Uri uri, {required Duration connectTimeout}) => WebSocketChannel.connect(uri);